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());
// Reset all current players
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;
} else {
@ -50,7 +50,7 @@ public class AdminResetsResetCommand extends ConfirmableCommand {
return false;
} else {
getPlayers().setResets(getWorld(), target, 0);
user.sendMessage("general.success");
user.sendMessage("commands.admin.resets.reset.success", TextVariables.NAME, args.get(0));
return true;
}
}

View File

@ -23,7 +23,7 @@ public class AdminResetsSetCommand extends CompositeCommand {
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty() || args.size() != 2) {
if (args.size() != 2) {
showHelp(this, user);
return false;
}
@ -31,11 +31,12 @@ public class AdminResetsSetCommand extends CompositeCommand {
UUID target = getPlayers().getUUID(args.get(0));
if (target == null) {
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));
} else {
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;
}

View File

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