fix: return Usernames as valid Teleportables, close #773

also correctly handle `TELEPORTER_INVALID` TeleportationExceptions with an error message
This commit is contained in:
William278 committed 2025-02-14 13:01:30 +00:00
1 parent dd4b300f0f
commit a049e5af94
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;
}
}