mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-03 00:57:34 +02:00
Added /heal and /slay.
This commit is contained in:
parent
7e481e6a9a
commit
c3f0bbb41c
@ -11,6 +11,12 @@ commands:
|
||||
god:
|
||||
description: Toggles god mode
|
||||
usage: /<command> [other player]
|
||||
heal:
|
||||
description: Heal yourself or another
|
||||
usage: /<command> [other player]
|
||||
slay:
|
||||
description: Slay yourself or another
|
||||
usage: /<command> [other player]
|
||||
stack:
|
||||
description: Stacks items in the player's inventory
|
||||
usage: /<command>
|
||||
|
@ -512,6 +512,60 @@ private boolean handleCommand(Player player, String cmd, String[] args)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("heal")) {
|
||||
checkPermission(player, "/heal");
|
||||
checkArgs(args, 0, 1);
|
||||
|
||||
// Allow healing other people
|
||||
if (args.length > 1) {
|
||||
if (!hasPermission(player, "/healother")) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to heal others.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player other = matchSinglePlayer(getServer(), args[1]);
|
||||
if (other == null) {
|
||||
player.sendMessage(ChatColor.RED + "Player not found.");
|
||||
} else {
|
||||
other.setHealth(20);
|
||||
player.sendMessage(ChatColor.YELLOW + other.getName() + " has been healed!");
|
||||
other.sendMessage(ChatColor.YELLOW + player.getName() + " has healed you!");
|
||||
}
|
||||
} else {
|
||||
player.setHealth(20);
|
||||
player.sendMessage(ChatColor.YELLOW + "You have been healed!");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("slay")) {
|
||||
checkPermission(player, "/slay");
|
||||
checkArgs(args, 0, 1);
|
||||
|
||||
// Allow killing other people
|
||||
if (args.length > 1) {
|
||||
if (!hasPermission(player, "/slayother")) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to kill others.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player other = matchSinglePlayer(getServer(), args[1]);
|
||||
if (other == null) {
|
||||
player.sendMessage(ChatColor.RED + "Player not found.");
|
||||
} else {
|
||||
other.setHealth(0);
|
||||
player.sendMessage(ChatColor.YELLOW + other.getName() + " has been killed!");
|
||||
other.sendMessage(ChatColor.YELLOW + player.getName() + " has killed you!");
|
||||
}
|
||||
} else {
|
||||
player.setHealth(0);
|
||||
player.sendMessage(ChatColor.YELLOW + "You have committed suicide!");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("stack")) {
|
||||
checkPermission(player, "stack");
|
||||
checkArgs(args, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user