mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-07 19:40:23 +01: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
|
@Override
|
||||||
public int broadcastMessage(final String message)
|
public int broadcastMessage(final String message)
|
||||||
{
|
{
|
||||||
return broadcastMessage(null, null, message);
|
return broadcastMessage(null, null, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int broadcastMessage(final IUser sender, final String message)
|
public int broadcastMessage(final IUser sender, final String message)
|
||||||
{
|
{
|
||||||
return broadcastMessage(sender, null, message);
|
return broadcastMessage(sender, null, message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int broadcastMessage(final String permission, final String message)
|
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())
|
if (sender != null && sender.isHidden())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IText input = new SimpleTextInput(message);
|
IText broadcast = new SimpleTextInput(message);
|
||||||
|
|
||||||
final Player[] players = getServer().getOnlinePlayers();
|
final Player[] players = getServer().getOnlinePlayers();
|
||||||
|
|
||||||
@ -651,8 +651,11 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
if ((permission == null && (sender == null || !user.isIgnoredPlayer(sender)))
|
if ((permission == null && (sender == null || !user.isIgnoredPlayer(sender)))
|
||||||
|| (permission != null && user.isAuthorized(permission)))
|
|| (permission != null && user.isAuthorized(permission)))
|
||||||
{
|
{
|
||||||
final IText output = new KeywordReplacer(input, player, this, false);
|
if (keywords)
|
||||||
for (String messageText : output.getLines())
|
{
|
||||||
|
broadcast = new KeywordReplacer(broadcast, player, this, false);
|
||||||
|
}
|
||||||
|
for (String messageText : broadcast.getLines())
|
||||||
{
|
{
|
||||||
player.sendMessage(messageText);
|
player.sendMessage(messageText);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,6 @@ public class Commandbroadcast extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
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