diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-12-28 22:35:55 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-12-28 22:37:36 +0000 |
commit | 46691871ad0d97b7db83d4bba7daacc483fa03d1 (patch) | |
tree | b1e738cfc39878715fb86025cfe6b00b129fbc41 | |
parent | 58440dd5948e21fbe48f19621054707aff097d44 (diff) | |
download | Essentials-46691871ad0d97b7db83d4bba7daacc483fa03d1.tar Essentials-46691871ad0d97b7db83d4bba7daacc483fa03d1.tar.gz Essentials-46691871ad0d97b7db83d4bba7daacc483fa03d1.tar.lz Essentials-46691871ad0d97b7db83d4bba7daacc483fa03d1.tar.xz Essentials-46691871ad0d97b7db83d4bba7daacc483fa03d1.zip |
Add permission: essentials.msg.multiple and essentials.pay.multiple
Message permission will allow rough nick matches and wildcards, while pay will only allow wildcards.
10 files changed, 21 insertions, 18 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index 37f94e5b6..6f6aab6e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -40,7 +40,7 @@ public class Commandeco extends EssentialsLoopCommand throw new NotEnoughArgumentsException(ex); } - loopOfflinePlayers(server, sender, false, args[1], args); + loopOfflinePlayers(server, sender, false, true, args[1], args); if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 23ab6ac40..06e09aba7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -22,7 +22,7 @@ public class Commandext extends EssentialsLoopCommand throw new NotEnoughArgumentsException(); } - loopOnlinePlayers(server, sender, true, args[0], null); + loopOnlinePlayers(server, sender, true, true, args[0], null); } @Override @@ -35,7 +35,7 @@ public class Commandext extends EssentialsLoopCommand return; } - loopOnlinePlayers(server, user.getSource(), true, args[0], null); + loopOnlinePlayers(server, user.getSource(), true, true, args[0], null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index f2df07f3c..f9ee82023 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -25,7 +25,7 @@ public class Commandfeed extends EssentialsLoopCommand if (args.length > 0 && user.isAuthorized("essentials.feed.others")) { - loopOnlinePlayers(server, user.getSource(), true, args[0], null); + loopOnlinePlayers(server, user.getSource(), true, true, args[0], null); return; } @@ -41,7 +41,7 @@ public class Commandfeed extends EssentialsLoopCommand throw new NotEnoughArgumentsException(); } - loopOnlinePlayers(server, sender, true, args[0], null); + loopOnlinePlayers(server, sender, true, true, args[0], null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index fb4477331..58679604d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -27,7 +27,7 @@ public class Commandheal extends EssentialsLoopCommand if (args.length > 0 && user.isAuthorized("essentials.heal.others")) { - loopOnlinePlayers(server, user.getSource(), true, args[0], null); + loopOnlinePlayers(server, user.getSource(), true, true, args[0], null); return; } @@ -42,7 +42,7 @@ public class Commandheal extends EssentialsLoopCommand throw new NotEnoughArgumentsException(); } - loopOnlinePlayers(server, sender, true, args[0], null); + loopOnlinePlayers(server, sender, true, true, args[0], null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index 3957e1e2c..2de3d1750 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -23,7 +23,7 @@ public class Commandkill extends EssentialsLoopCommand throw new NotEnoughArgumentsException(); } - loopOnlinePlayers(server, sender, true, args[0], null); + loopOnlinePlayers(server, sender, true, true, args[0], null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index f6d5b6318..12cff3f1a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -40,7 +40,7 @@ public class Commandlightning extends EssentialsLoopCommand { } } - loopOnlinePlayers(server, sender, true, args[0], null); + loopOnlinePlayers(server, sender, true, true, args[0], null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 31156813b..f6d6bf45f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -29,6 +29,7 @@ public class Commandmsg extends EssentialsLoopCommand } String message = getFinalArg(args, 1); + boolean canWildcard; if (sender.isPlayer()) { User user = ess.getUser(sender.getPlayer()); @@ -37,10 +38,12 @@ public class Commandmsg extends EssentialsLoopCommand throw new Exception(_("voiceSilenced")); } message = FormatUtil.formatMessage(user, "essentials.msg", message); + canWildcard = user.isAuthorized("essentials.msg.multiple"); } else { message = FormatUtil.replaceFormat(message); + canWildcard = true; } if (args[0].equalsIgnoreCase(Console.NAME)) @@ -56,7 +59,7 @@ public class Commandmsg extends EssentialsLoopCommand return; } - loopOnlinePlayers(server, sender, false, args[0], new String[]{message}); + loopOnlinePlayers(server, sender, canWildcard, canWildcard, args[0], new String[]{message}); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index 94528af6f..dc27ca557 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -32,7 +32,7 @@ public class Commandnick extends EssentialsLoopCommand if (args.length > 1 && user.isAuthorized("essentials.nick.others")) { final String[] nickname = formatNickname(user, args[1]).split(" "); - loopOfflinePlayers(server, user.getSource(), false, args[0], nickname); + loopOfflinePlayers(server, user.getSource(), false, true, args[0], nickname); user.sendMessage(_("nickChanged")); } else @@ -54,7 +54,7 @@ public class Commandnick extends EssentialsLoopCommand throw new Exception(_("nickDisplayName")); } final String[] nickname = formatNickname(null, args[1]).split(" "); - loopOfflinePlayers(server, sender, false, args[0], nickname); + loopOfflinePlayers(server, sender, false, true, args[0], nickname); sender.sendMessage(_("nickChanged")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index c6826717b..2dc95db0d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -26,7 +26,7 @@ public class Commandpay extends EssentialsLoopCommand } amount = new BigDecimal(args[1].replaceAll("[^0-9\\.]", "")); - loopOnlinePlayers(server, user.getSource(), false, args[0], args); + loopOnlinePlayers(server, user.getSource(), false, user.isAuthorized("essentials.pay.multiple"), args[0], args); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java index c34fe8bd6..271636358 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java @@ -15,7 +15,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand super(command); } - protected void loopOfflinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) + protected void loopOfflinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, boolean matchWildcards, final String searchTerm, final String[] commandArgs) throws PlayerNotFoundException, NotEnoughArgumentsException, PlayerExemptException, ChargeException { if (searchTerm.isEmpty()) @@ -23,7 +23,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand throw new PlayerNotFoundException(); } - if (searchTerm.contentEquals("**")) + if (matchWildcards && searchTerm.contentEquals("**")) { for (String sUser : ess.getUserMap().getAllUniqueUsers()) { @@ -31,7 +31,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand updatePlayer(server, sender, matchedUser, commandArgs); } } - else if (searchTerm.contentEquals("*")) + else if (matchWildcards && searchTerm.contentEquals("*")) { boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact"); for (Player onlinePlayer : server.getOnlinePlayers()) @@ -69,7 +69,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand } } - protected void loopOnlinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) + protected void loopOnlinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, boolean matchWildcards, final String searchTerm, final String[] commandArgs) throws PlayerNotFoundException, NotEnoughArgumentsException, PlayerExemptException, ChargeException { if (searchTerm.isEmpty()) @@ -79,7 +79,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact"); - if (searchTerm.contentEquals("**") || searchTerm.contentEquals("*")) + if (matchWildcards && (searchTerm.contentEquals("**") || searchTerm.contentEquals("*"))) { for (Player onlinePlayer : server.getOnlinePlayers()) { |