mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-06 04:58:00 +02:00
Allow new lines and add secure broadcast keywords.
This commit is contained in:
parent
aa6d85eacc
commit
8fb91c5a61
@ -619,29 +619,29 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
@Override
|
||||
public int broadcastMessage(final String message)
|
||||
{
|
||||
return broadcastMessage(null, null, message);
|
||||
return broadcastMessage(null, null, message, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int broadcastMessage(final IUser sender, final String message)
|
||||
{
|
||||
return broadcastMessage(sender, null, message);
|
||||
return broadcastMessage(sender, null, message, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int broadcastMessage(final String permission, final String message)
|
||||
{
|
||||
return broadcastMessage(null, permission, message);
|
||||
return broadcastMessage(null, permission, message, false);
|
||||
}
|
||||
|
||||
private int broadcastMessage(final IUser sender, final String permission, final String message)
|
||||
private int broadcastMessage(final IUser sender, final String permission, final String message, final boolean keywords)
|
||||
{
|
||||
if (sender != null && sender.isHidden())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
final IText input = new SimpleTextInput(message);
|
||||
IText broadcast = new SimpleTextInput(message);
|
||||
|
||||
final Player[] players = getServer().getOnlinePlayers();
|
||||
|
||||
@ -651,8 +651,11 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
if ((permission == null && (sender == null || !user.isIgnoredPlayer(sender)))
|
||||
|| (permission != null && user.isAuthorized(permission)))
|
||||
{
|
||||
final IText output = new KeywordReplacer(input, player, this, false);
|
||||
for (String messageText : output.getLines())
|
||||
if (keywords)
|
||||
{
|
||||
broadcast = new KeywordReplacer(broadcast, player, this, false);
|
||||
}
|
||||
for (String messageText : broadcast.getLines())
|
||||
{
|
||||
player.sendMessage(messageText);
|
||||
}
|
||||
|
@ -33,6 +33,6 @@ public class Commandbroadcast extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ess.broadcastMessage(_("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0)), name));
|
||||
ess.broadcastMessage(_("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0)).replace("\\n", "\n"), name));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user