Update locales, add tpall check for no online players

This commit is contained in:
William278 committed 2023-03-24 11:25:03 +00:00
1 parent 33fdab44f2
commit e8e9b1ffb9
15 files changed
+36 -143

No files matched your search

@@ -65,6 +65,7 @@ public class TpCommand extends Command implements TabProvider {
// Execute a teleport
private void execute(@NotNull CommandUser executor, @NotNull Teleportable teleportable, @NotNull Target target,
@NotNull String[] args) {
// Build and execute the teleport
final TeleportBuilder builder = Teleport.builder(plugin)
.teleporter(teleportable)
.target(target);
@@ -75,6 +76,20 @@ public class TpCommand extends Command implements TabProvider {
builder.toTeleport().execute();
} catch (TeleportationException e) {
e.displayMessage(executor, plugin, args);
return;
}
// Display teleport completion message
final String teleporterName = teleportable instanceof OnlineUser user
? user.getUsername() : ((Username) teleportable).name();
if (target instanceof Position position) {
plugin.getLocales().getLocale("teleporting_other_complete_position", teleporterName,
Integer.toString((int) position.getX()), Integer.toString((int) position.getY()),
Integer.toString((int) position.getZ()))
.ifPresent(executor::sendMessage);
} else {
plugin.getLocales().getLocale("teleporting_other_complete", teleporterName, ((Username) target).name())
.ifPresent(executor::sendMessage);
}
}