mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
fix: return Usernames as valid Teleportables, close #773
also correctly handle `TELEPORTER_INVALID` TeleportationExceptions with an error message
This commit is contained in:
19 files changed
+22
-2
No files matched your search
@@ -55,7 +55,8 @@ public class TpHereCommand extends InGameCommand implements UserListTabCompletab
|
||||
.target(executor.getPosition())
|
||||
.buildAndComplete(false, target);
|
||||
|
||||
plugin.getLocales().getLocale("teleporting_other_complete", target, executor.getName());
|
||||
plugin.getLocales().getLocale("teleporting_other_complete", target, executor.getName())
|
||||
.ifPresent(executor::sendMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,6 +45,9 @@ public class TeleportationException extends IllegalStateException {
|
||||
case TELEPORTER_NOT_FOUND -> plugin.getLocales()
|
||||
.getLocale("error_player_not_found", args)
|
||||
.ifPresent(user::sendMessage);
|
||||
case TELEPORTER_INVALID -> plugin.getLocales()
|
||||
.getLocale("error_player_not_teleportable", args)
|
||||
.ifPresent(user::sendMessage);
|
||||
case TARGET_NOT_FOUND -> plugin.getLocales()
|
||||
.getLocale("error_target_not_found")
|
||||
.ifPresent(user::sendMessage);
|
||||
|
||||
@@ -72,6 +72,6 @@ public record Username(@NotNull String name) implements Teleportable, Target {
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user