diff options
author | snowleo <schneeleo@gmail.com> | 2011-07-15 19:52:29 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-07-15 19:52:29 +0200 |
commit | 7e65038ae76d3ce427158b61bd0957a47cbfb635 (patch) | |
tree | ced034cf58097c08eb3253147722ee8fdcf91414 /EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java | |
parent | 37d77f3e89c7af9e8dffbd7e1c59ddea9e936eb4 (diff) | |
download | Essentials-7e65038ae76d3ce427158b61bd0957a47cbfb635.tar Essentials-7e65038ae76d3ce427158b61bd0957a47cbfb635.tar.gz Essentials-7e65038ae76d3ce427158b61bd0957a47cbfb635.tar.lz Essentials-7e65038ae76d3ce427158b61bd0957a47cbfb635.tar.xz Essentials-7e65038ae76d3ce427158b61bd0957a47cbfb635.zip |
Log Protection alerts to the console
Also added the world name, which was missing.
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java')
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index afa98b568..a8f6a3530 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -26,7 +26,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsProtect extends JavaPlugin implements IConf, IProtect { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final transient Map<ProtectConfig, Boolean> settingsBoolean = new EnumMap<ProtectConfig, Boolean>(ProtectConfig.class); private final transient Map<ProtectConfig, String> settingsString = new EnumMap<ProtectConfig, String>(ProtectConfig.class); private final transient Map<ProtectConfig, List<Integer>> settingsList = new EnumMap<ProtectConfig, List<Integer>>(ProtectConfig.class); @@ -79,33 +78,37 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect public void alert(final User user, final String item, final String type) { final Location loc = user.getLocation(); + final String warnMessage = Util.format("alertFormat", user.getName(), type, item, + loc.getWorld().getName() + "," + loc.getBlockX() + "," + + loc.getBlockY() + "," + loc.getBlockZ()); + LOGGER.log(Level.WARNING, warnMessage); for (Player p : this.getServer().getOnlinePlayers()) { final User alertUser = ess.getUser(p); if (alertUser.isAuthorized("essentials.protect.alerts")) { - alertUser.sendMessage(Util.format("alertFormat", user.getName(), type, item, formatCoords(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))); + alertUser.sendMessage(warnMessage); } } } - public static String formatCoords(final int x, final int y, final int z) - { - return x + "," + y + "," + z; - } - public void reloadConfig() { for (ProtectConfig protectConfig : ProtectConfig.values()) { - if (protectConfig.isList()) { + if (protectConfig.isList()) + { settingsList.put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); - } else if (protectConfig.isString()) { + } + else if (protectConfig.isString()) + { settingsString.put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); - } else { + } + else + { settingsBoolean.put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); } - + } if (getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) @@ -144,14 +147,14 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect { return storage; } - + @Override public boolean getSettingBool(final ProtectConfig protectConfig) { final Boolean bool = settingsBoolean.get(protectConfig); return bool == null ? protectConfig.getDefaultValueBoolean() : bool; } - + @Override public String getSettingString(final ProtectConfig protectConfig) { |