mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 10:31:31 +01:00
Add permission: essentials.msg.multiple and essentials.pay.multiple
Message permission will allow rough nick matches and wildcards, while pay will only allow wildcards.
This commit is contained in:
parent
58440dd594
commit
46691871ad
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user