From 291ffb0bbaecce159d585cd19e182b4f070f3027 Mon Sep 17 00:00:00 2001 From: Elvaron Date: Thu, 20 Dec 2012 23:07:22 +0100 Subject: Made socialspy commands list configurable --- .../essentials/EssentialsPlayerListener.java | 3 +-- .../src/com/earth2me/essentials/ISettings.java | 2 ++ .../src/com/earth2me/essentials/Settings.java | 19 ++++++++++++++++ Essentials/src/config.yml | 26 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 433fe816f..8887955a4 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -335,14 +335,13 @@ public class EssentialsPlayerListener implements Listener }); } } - private final static List COMMANDS = Arrays.asList("msg", "w", "r", "mail", "m", "t", "whisper", "emsg", "tell", "er", "reply", "ereply", "email", "action", "describe", "eme", "eaction", "edescribe", "etell", "ewhisper", "pm"); @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) { final Player player = event.getPlayer(); final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH); - if (COMMANDS.contains(cmd)) + if (ess.getSettings().getSocialSpyCommands().contains(cmd)) { for (Player onlinePlayer : ess.getServer().getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 1ad9b0207..a261c80bb 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -42,6 +42,8 @@ public interface ISettings extends IConf double getHealCooldown(); + Set getSocialSpyCommands(); + Map getKit(String name); ConfigurationSection getKits(); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 8ce392abb..71cee631c 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -237,6 +237,24 @@ public class Settings implements ISettings } return 0.0; } + + private Set socialSpyCommands = new HashSet(); + + public Set _getSocialSpyCommands() + { + Set socialspyCommands = new HashSet(); + for (String c : config.getStringList("socialspy-commands")) + { + socialspyCommands.add(c.toLowerCase(Locale.ENGLISH)); + } + + return socialspyCommands; + } + + public Set getSocialSpyCommands() { + return socialSpyCommands; + } + private String nicknamePrefix = "~"; private String _getNicknamePrefix() @@ -462,6 +480,7 @@ public class Settings implements ISettings disableSuffix = _disableSuffix(); chatRadius = _getChatRadius(); commandCosts = _getCommandCosts(); + socialSpyCommands = _getSocialSpyCommands(); warnOnBuildDisallow = _warnOnBuildDisallow(); mailsPerMinute = _getMailsPerMinute(); } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index e428354a8..c5adec0b0 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -91,6 +91,32 @@ overridden-commands: disabled-commands: # - nick +# These commands will be shown to players with socialSpy enabled +# You can add commands from other plugins you may want to track or +# remove commands that are used for something you dont want to spy on +socialspy-commands: + - msg + - w + - r + - mail + - m + - t + - whisper + - emsg + - tell + - er + - reply + - ereply + - email + - action + - describe + - eme + - eaction + - edescribe + - etell + - ewhisper + - pm + # If you do not wish to use a permission system, you can define a list of 'player perms' below. # This list has no effect if you are using a supported permissions system. # If you are using an unsupported permissions system simply delete this section. -- cgit v1.2.3