From c0e903c1f398d101a55288de03fb62afa9c926e4 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 9 Dec 2011 21:42:36 +0000 Subject: New permissions: essentials.powertool.append. --- Essentials/src/com/earth2me/essentials/User.java | 6 +++--- Essentials/src/com/earth2me/essentials/commands/Commandmail.java | 4 ++-- .../src/com/earth2me/essentials/commands/Commandpowertool.java | 7 ++++++- Essentials/src/plugin.yml | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index d07351758..abe11179b 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -175,7 +175,7 @@ public class User extends UserData implements Comparable, IReplyTo, IUser @Override public int compareTo(final User other) { - return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(other.getDisplayName())); + return this.getName().compareToIgnoreCase(other.getName()); } @Override @@ -185,14 +185,14 @@ public class User extends UserData implements Comparable, IReplyTo, IUser { return false; } - return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)object).getDisplayName())); + return this.getName().equalsIgnoreCase(((User)object).getName()); } @Override public int hashCode() { - return ChatColor.stripColor(this.getDisplayName()).hashCode(); + return this.getName().hashCode(); } public Boolean canSpawnItem(final int itemId) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 884238393..6a66186e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -58,7 +58,7 @@ public class Commandmail extends EssentialsCommand } if (!u.isIgnoredPlayer(user.getName())) { - u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2)); + u.addMail(user.getName() + ": " + getFinalArg(args, 2)); } user.sendMessage(_("mailSent")); return; @@ -69,7 +69,7 @@ public class Commandmail extends EssentialsCommand { throw new Exception(_("noPerm","essentials.mail.sendall")); } - ess.scheduleAsyncDelayedTask(new SendAll(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 1))); + ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + getFinalArg(args, 1))); user.sendMessage(_("mailSent")); return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index b442d4db8..ca03364b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -24,7 +24,7 @@ public class Commandpowertool extends EssentialsCommand String command = getFinalArg(args, 0); // check to see if this is a clear all command - if (command != null && command.equalsIgnoreCase("c:")) + if (command != null && command.equalsIgnoreCase("d:")) { user.clearAllPowertools(); user.sendMessage(_("powerToolClearAll")); @@ -76,11 +76,16 @@ public class Commandpowertool extends EssentialsCommand { if (command.startsWith("a:")) { + if (!user.isAuthorized("essentials.powertool.append")) + { + throw new Exception(_("noPerm", "essentials.powertool.append")); + } command = command.substring(2); if (powertools.contains(command)) { throw new Exception(_("powerToolAlreadySet", command, itemName)); } + } else if (powertools != null && !powertools.isEmpty()) { diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 275501ab5..c3ed49ad1 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -240,7 +240,7 @@ commands: aliases: [pong,eping,epong] powertool: description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. - usage: / [l:|a:|r:|c:][command] [arguments] + usage: / [l:|a:|r:|c:|d:][command] [arguments] aliases: [pt,epowertool,ept] powertooltoggle: description: Enables or disables all current powertools -- cgit v1.2.3