mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Added admin command to reset/set deaths
#76 * Added AdminDeathsCommand * Added AdminDeathsResetCommand * Added AdminDeathsSetCommand * Updated en-US locale accordingly * Added "general.errors.must-be-positive-number" to the en-US locale * Fixed some formatting in the en-US locale
This commit is contained in:
parent
7a888fce95
commit
486de0dc19
@ -0,0 +1,31 @@
|
|||||||
|
package world.bentobox.bentobox.api.commands.admin.deaths;
|
||||||
|
|
||||||
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Poslovitch
|
||||||
|
*/
|
||||||
|
public class AdminDeathsCommand extends CompositeCommand {
|
||||||
|
|
||||||
|
public AdminDeathsCommand(CompositeCommand parent) {
|
||||||
|
super(parent, "deaths");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
setPermission("admin.deaths");
|
||||||
|
setDescription("commands.admin.deaths.description");
|
||||||
|
|
||||||
|
new AdminDeathsResetCommand(this);
|
||||||
|
new AdminDeathsSetCommand(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
showHelp(this, user);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package world.bentobox.bentobox.api.commands.admin.deaths;
|
||||||
|
|
||||||
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Poslovitch
|
||||||
|
*/
|
||||||
|
public class AdminDeathsResetCommand extends CompositeCommand {
|
||||||
|
|
||||||
|
public AdminDeathsResetCommand(AdminDeathsCommand parent) {
|
||||||
|
super(parent, "reset");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
setDescription("commands.admin.deaths.reset.description");
|
||||||
|
setParametersHelp("commands.admin.deaths.reset.parameters");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
if (args.isEmpty() || args.size() != 1) {
|
||||||
|
showHelp(this, user);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID target = getPlayers().getUUID(args.get(0));
|
||||||
|
if (target == null) {
|
||||||
|
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
getPlayers().setDeaths(getWorld(), target, 0);
|
||||||
|
user.sendMessage("general.success");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package world.bentobox.bentobox.api.commands.admin.deaths;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Poslovitch
|
||||||
|
*/
|
||||||
|
public class AdminDeathsSetCommand extends CompositeCommand {
|
||||||
|
|
||||||
|
public AdminDeathsSetCommand(AdminDeathsCommand parent) {
|
||||||
|
super(parent, "set");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
setDescription("commands.admin.deaths.set.description");
|
||||||
|
setParametersHelp("commands.admin.deaths.set.parameters");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
if (args.isEmpty() || args.size() != 2) {
|
||||||
|
showHelp(this, user);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(1));
|
||||||
|
} else {
|
||||||
|
getPlayers().setDeaths(getWorld(), target, Integer.valueOf(args.get(1)));
|
||||||
|
user.sendMessage("general.success");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ meta:
|
|||||||
general:
|
general:
|
||||||
success: "&aSuccess!"
|
success: "&aSuccess!"
|
||||||
errors:
|
errors:
|
||||||
command-cancelled: "&cCommand cancelled"
|
command-cancelled: "&cCommand cancelled."
|
||||||
no-permission: "&cYou don't have the permission to execute this command (&7[permission]&c)."
|
no-permission: "&cYou don't have the permission to execute this command (&7[permission]&c)."
|
||||||
use-in-game: "&cThis command is only available in game."
|
use-in-game: "&cThis command is only available in game."
|
||||||
no-team: "&cYou do not have a team!"
|
no-team: "&cYou do not have a team!"
|
||||||
@ -32,6 +32,7 @@ general:
|
|||||||
warp-not-safe: "&cThat warp is not safe right now!"
|
warp-not-safe: "&cThat warp is not safe right now!"
|
||||||
wrong-world: "&cYou are not in the right world to do that!"
|
wrong-world: "&cYou are not in the right world to do that!"
|
||||||
you-must-wait: "&cYou must wait [number]s before you can do that command again."
|
you-must-wait: "&cYou must wait [number]s before you can do that command again."
|
||||||
|
must-be-positive-number: "&c[number] is not a valid positive number."
|
||||||
tips:
|
tips:
|
||||||
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
|
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ commands:
|
|||||||
kick:
|
kick:
|
||||||
parameters: "<team player>"
|
parameters: "<team player>"
|
||||||
description: "kick a player from a team"
|
description: "kick a player from a team"
|
||||||
cannot-kick-owner: "&cYou cannot kick the owner. Kick members first"
|
cannot-kick-owner: "&cYou cannot kick the owner. Kick members first."
|
||||||
admin-kicked: "&cThe admin kicked you from the team."
|
admin-kicked: "&cThe admin kicked you from the team."
|
||||||
setowner:
|
setowner:
|
||||||
parameters: "<player>"
|
parameters: "<player>"
|
||||||
@ -194,9 +195,17 @@ commands:
|
|||||||
deleted-island: "&aIsland at &e[xyz] &ahas been successfully deleted."
|
deleted-island: "&aIsland at &e[xyz] &ahas been successfully deleted."
|
||||||
why:
|
why:
|
||||||
parameters: "<player>"
|
parameters: "<player>"
|
||||||
description: "Toggle console protection debug reporting"
|
description: "toggle console protection debug reporting"
|
||||||
turning-on: "Turning on console debug for [name]"
|
turning-on: "Turning on console debug for [name]"
|
||||||
turning-off: "Turning off console debug for [name]"
|
turning-off: "Turning off console debug for [name]"
|
||||||
|
deaths:
|
||||||
|
description: "edit deaths of players"
|
||||||
|
reset:
|
||||||
|
description: "resets deaths of the player"
|
||||||
|
parameters: "<player>"
|
||||||
|
set:
|
||||||
|
description: "sets deaths of the player"
|
||||||
|
parameters: "<player> <deaths>"
|
||||||
bentobox:
|
bentobox:
|
||||||
description: "BentoBox admin command"
|
description: "BentoBox admin command"
|
||||||
about:
|
about:
|
||||||
|
Loading…
Reference in New Issue
Block a user