mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Update locales, add tpall check for no online players
This commit is contained in:
1 parent
33fdab44f2
commit
e8e9b1ffb9
15 files changed
+36
-143
No files matched your search
@@ -20,6 +20,12 @@ public class TpAllCommand extends InGameCommand {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull OnlineUser executor, @NotNull String[] args) {
|
||||
if (plugin.getGlobalPlayerList().size() <= 1) {
|
||||
plugin.getLocales().getLocale("error_no_players_online")
|
||||
.ifPresent(executor::sendMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
final Position targetPosition = executor.getPosition();
|
||||
try {
|
||||
for (OnlineUser user : plugin.getOnlineUsers()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ public class TpHereCommand extends InGameCommand implements UserListTabProvider
|
||||
.teleporter(optionalTarget.get())
|
||||
.target(executor.getPosition())
|
||||
.toTeleport().execute();
|
||||
|
||||
plugin.getLocales().getLocale("teleporting_other_complete",
|
||||
optionalTarget.get(), executor.getUsername());
|
||||
} catch (TeleportationException e) {
|
||||
e.displayMessage(executor, plugin, args);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ public class TpaAllCommand extends InGameCommand {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull OnlineUser executor, @NotNull String[] args) {
|
||||
if (plugin.getGlobalPlayerList().size() <= 1) {
|
||||
plugin.getLocales().getLocale("error_no_players_online")
|
||||
.ifPresent(executor::sendMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getManager().requests().isIgnoringRequests(executor)) {
|
||||
plugin.getLocales().getLocale("error_ignoring_teleport_requests")
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
Reference in new issue
Block a user