New permissions: essentials.powertool.append.

This commit is contained in:
KHobbits 2011-12-09 21:42:36 +00:00
parent f99867dd0a
commit c0e903c1f3
4 changed files with 12 additions and 7 deletions

View file

@ -175,7 +175,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override @Override
public int compareTo(final User other) public int compareTo(final User other)
{ {
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(other.getDisplayName())); return this.getName().compareToIgnoreCase(other.getName());
} }
@Override @Override
@ -185,14 +185,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{ {
return false; return false;
} }
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)object).getDisplayName())); return this.getName().equalsIgnoreCase(((User)object).getName());
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
return ChatColor.stripColor(this.getDisplayName()).hashCode(); return this.getName().hashCode();
} }
public Boolean canSpawnItem(final int itemId) public Boolean canSpawnItem(final int itemId)

View file

@ -58,7 +58,7 @@ public class Commandmail extends EssentialsCommand
} }
if (!u.isIgnoredPlayer(user.getName())) if (!u.isIgnoredPlayer(user.getName()))
{ {
u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2)); u.addMail(user.getName() + ": " + getFinalArg(args, 2));
} }
user.sendMessage(_("mailSent")); user.sendMessage(_("mailSent"));
return; return;
@ -69,7 +69,7 @@ public class Commandmail extends EssentialsCommand
{ {
throw new Exception(_("noPerm","essentials.mail.sendall")); 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")); user.sendMessage(_("mailSent"));
return; return;
} }

View file

@ -24,7 +24,7 @@ public class Commandpowertool extends EssentialsCommand
String command = getFinalArg(args, 0); String command = getFinalArg(args, 0);
// check to see if this is a clear all command // 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.clearAllPowertools();
user.sendMessage(_("powerToolClearAll")); user.sendMessage(_("powerToolClearAll"));
@ -76,11 +76,16 @@ public class Commandpowertool extends EssentialsCommand
{ {
if (command.startsWith("a:")) if (command.startsWith("a:"))
{ {
if (!user.isAuthorized("essentials.powertool.append"))
{
throw new Exception(_("noPerm", "essentials.powertool.append"));
}
command = command.substring(2); command = command.substring(2);
if (powertools.contains(command)) if (powertools.contains(command))
{ {
throw new Exception(_("powerToolAlreadySet", command, itemName)); throw new Exception(_("powerToolAlreadySet", command, itemName));
} }
} }
else if (powertools != null && !powertools.isEmpty()) else if (powertools != null && !powertools.isEmpty())
{ {

View file

@ -240,7 +240,7 @@ commands:
aliases: [pong,eping,epong] aliases: [pong,eping,epong]
powertool: powertool:
description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click.
usage: /<command> [l:|a:|r:|c:][command] [arguments] usage: /<command> [l:|a:|r:|c:|d:][command] [arguments]
aliases: [pt,epowertool,ept] aliases: [pt,epowertool,ept]
powertooltoggle: powertooltoggle:
description: Enables or disables all current powertools description: Enables or disables all current powertools