Improved success messages for AdminResetsSetCommand and AdminResetsResetCommand

Also allowed AdminResetsSetCommand to set the resets to 0.
This commit is contained in:
Florian CUNY 2019-09-29 09:55:00 +02:00
parent e20690935a
commit 6c3667e3ed
3 changed files with 9 additions and 5 deletions

View File

@ -39,7 +39,7 @@ public class AdminResetsResetCommand extends ConfirmableCommand {
getIWM().setResetEpoch(getWorld()); getIWM().setResetEpoch(getWorld());
// Reset all current players // Reset all current players
Bukkit.getOnlinePlayers().stream().map(Player::getUniqueId).filter(getPlayers()::isKnown).forEach(u -> getPlayers().setResets(getWorld(), u, 0)); Bukkit.getOnlinePlayers().stream().map(Player::getUniqueId).filter(getPlayers()::isKnown).forEach(u -> getPlayers().setResets(getWorld(), u, 0));
user.sendMessage("general.success"); user.sendMessage("commands.admin.resets.reset.success-everyone");
}); });
return true; return true;
} else { } else {
@ -50,7 +50,7 @@ public class AdminResetsResetCommand extends ConfirmableCommand {
return false; return false;
} else { } else {
getPlayers().setResets(getWorld(), target, 0); getPlayers().setResets(getWorld(), target, 0);
user.sendMessage("general.success"); user.sendMessage("commands.admin.resets.reset.success", TextVariables.NAME, args.get(0));
return true; return true;
} }
} }

View File

@ -23,7 +23,7 @@ public class AdminResetsSetCommand extends CompositeCommand {
@Override @Override
public boolean execute(User user, String label, List<String> args) { public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty() || args.size() != 2) { if (args.size() != 2) {
showHelp(this, user); showHelp(this, user);
return false; return false;
} }
@ -31,11 +31,12 @@ public class AdminResetsSetCommand extends CompositeCommand {
UUID target = getPlayers().getUUID(args.get(0)); UUID target = getPlayers().getUUID(args.get(0));
if (target == null) { if (target == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0)); user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
} else if (!NumberUtils.isNumber(args.get(1)) || Integer.valueOf(args.get(1)) < 0) { } else if (!NumberUtils.isNumber(args.get(1)) || Integer.valueOf(args.get(1)) <= 0) {
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(1)); user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(1));
} else { } else {
getPlayers().setResets(getWorld(), target, Integer.valueOf(args.get(1))); getPlayers().setResets(getWorld(), target, Integer.valueOf(args.get(1)));
user.sendMessage("general.success"); user.sendMessage("commands.admin.resets.set.success",
TextVariables.NAME, args.get(0), TextVariables.NUMBER, args.get(1));
return true; return true;
} }

View File

@ -54,9 +54,12 @@ commands:
set: set:
description: "sets the resets of this player" description: "sets the resets of this player"
parameters: "<player> <resets>" parameters: "<player> <resets>"
success: "&aSuccessfully set &b[name]&a's resets to &b[number]&a."
reset: reset:
description: "resets the resets of this player to 0" description: "resets the resets of this player to 0"
parameters: "<player>" parameters: "<player>"
success-everyone: "&aSuccessfully reset &beveryone&a's name resets to &b0&a."
success: "&aSuccessfully reset &b[name]&a's resets to &b0&a."
purge: purge:
parameters: "[days]" parameters: "[days]"
description: "purge islands abandoned for more than [days]" description: "purge islands abandoned for more than [days]"