diff --git a/plugin.yml b/plugin.yml index ee8d91a7..7a22fa62 100644 --- a/plugin.yml +++ b/plugin.yml @@ -11,6 +11,12 @@ commands: god: description: Toggles god mode usage: / [other player] + heal: + description: Heal yourself or another + usage: / [other player] + slay: + description: Slay yourself or another + usage: / [other player] stack: description: Stacks items in the player's inventory usage: / diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index 5213266d..eb0f507d 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -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);