diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-06-16 01:18:35 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-06-16 01:18:35 +0100 |
commit | 23041abfbebeffa6ec3bffd3ee96beb4401bdea4 (patch) | |
tree | 5efd3b603f110185357bb923e5d9af683e98b5a8 | |
parent | 92b71ae3522f5a1f9439a102f5efe953e711aa8e (diff) | |
download | Essentials-23041abfbebeffa6ec3bffd3ee96beb4401bdea4.tar Essentials-23041abfbebeffa6ec3bffd3ee96beb4401bdea4.tar.gz Essentials-23041abfbebeffa6ec3bffd3ee96beb4401bdea4.tar.lz Essentials-23041abfbebeffa6ec3bffd3ee96beb4401bdea4.tar.xz Essentials-23041abfbebeffa6ec3bffd3ee96beb4401bdea4.zip |
Allow new lines and add secure broadcast keywords.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Essentials.java | 17 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 4981897e1..2cd6c0c97 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -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); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java index 2f9bea293..c68ed5000 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java @@ -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)); } } |