diff --git a/configuration.txt b/configuration.txt index b1e20884..71e6ef2f 100755 --- a/configuration.txt +++ b/configuration.txt @@ -19,6 +19,10 @@ webserver-bindaddress: 0.0.0.0 # The TCP-port the webserver will listen on. webserver-port: 8123 +disabledcommands: + - fullrender + - fullrenderasync + # The maptypes Dynmap will use to render. maps: - class: org.dynmap.kzedmap.KzedMap diff --git a/src/main/java/org/dynmap/DynmapPlayerListener.java b/src/main/java/org/dynmap/DynmapPlayerListener.java index e643b984..89ae1a32 100644 --- a/src/main/java/org/dynmap/DynmapPlayerListener.java +++ b/src/main/java/org/dynmap/DynmapPlayerListener.java @@ -3,14 +3,17 @@ package org.dynmap; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerListener; +import org.bukkit.util.config.ConfigurationNode; public class DynmapPlayerListener extends PlayerListener { private MapManager mgr; private PlayerList playerList; + private ConfigurationNode configuration; - public DynmapPlayerListener(MapManager mgr, PlayerList playerList) { + public DynmapPlayerListener(MapManager mgr, PlayerList playerList, ConfigurationNode configuration) { this.mgr = mgr; this.playerList = playerList; + this.configuration = configuration; } @Override @@ -18,6 +21,12 @@ public class DynmapPlayerListener extends PlayerListener { String[] split = event.getMessage().split(" "); if (split[0].equalsIgnoreCase("/dynmap")) { if (split.length > 1) { + for(String s : (Iterable)configuration.getProperty("disabledcommands")) { + if (split[1].equals(s)) { + return; + } + } + if (split[1].equals("render")) { Player player = event.getPlayer(); mgr.touch(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()); diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index a5fa55b5..e3aab1ea 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -12,6 +12,7 @@ import org.bukkit.World; import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; import org.bukkit.event.block.BlockListener; +import org.bukkit.event.player.PlayerListener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginLoader; import org.bukkit.plugin.java.JavaPlugin; @@ -29,6 +30,7 @@ public class DynmapPlugin extends JavaPlugin { private HttpServer webServer = null; private MapManager mapManager = null; private PlayerList playerList; + private Configuration configuration; private BukkitPlayerDebugger debugger = new BukkitPlayerDebugger(this); @@ -52,7 +54,7 @@ public class DynmapPlugin extends JavaPlugin { } public void onEnable() { - Configuration configuration = new Configuration(new File(this.getDataFolder(), "configuration.txt")); + configuration = new Configuration(new File(this.getDataFolder(), "configuration.txt")); configuration.load(); debugger.enable(); @@ -105,7 +107,8 @@ public class DynmapPlugin extends JavaPlugin { getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, new DynmapPlayerListener(mapManager, playerList), Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, new DynmapPlayerListener(mapManager, playerList), Priority.Normal, this); + PlayerListener playerListener = new DynmapPlayerListener(mapManager, playerList, configuration); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this); } }