Added option to disable block placing/breaking logging.

This commit is contained in:
Robin Kupper
2011-04-13 12:46:19 +02:00
parent a0ab118bd1
commit 2feac1b105
2 changed files with 16 additions and 4 deletions

View File

@ -23,6 +23,8 @@ public class Config {
final int toolID;
final int toolblockID;
final boolean toolblockRemove;
final boolean logBlockCreations;
final boolean logBlockDestroyings;
final boolean logSignTexts;
final boolean logExplosions;
final boolean logFire;
@ -73,6 +75,10 @@ public class Config {
config.setProperty("toolblockID", 7);
if (!keys.contains("toolblockRemove"))
config.setProperty("toolblockRemove", true);
if (!keys.contains("logBlockCreations"))
config.setProperty("logBlockCreations", true);
if (!keys.contains("logBlockDestroyings"))
config.setProperty("logBlockDestroyings", true);
if (!keys.contains("logSignTexts"))
config.setProperty("logSignTexts", false);
if (!keys.contains("logExplosions"))
@ -113,6 +119,8 @@ public class Config {
if (Material.getMaterial(toolblockID) == null || !Material.getMaterial(toolblockID).isBlock() || toolblockID == 0)
throw new Exception("toolblockID doesn't appear to be a valid block id");
toolblockRemove = config.getBoolean("toolblockRemove", true);
logBlockCreations = config.getBoolean("logBlockCreations", true);
logBlockDestroyings = config.getBoolean("logBlockDestroyings", true);
logSignTexts = config.getBoolean("logSignTexts", false);
logExplosions = config.getBoolean("logExplosions", false);
logFire = config.getBoolean("logFire", false);

View File

@ -108,11 +108,15 @@ public class LogBlock extends JavaPlugin
LBPlayerListener lbPlayerListener = new LBPlayerListener();
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Type.PLAYER_INTERACT, new LBToolPlayerListener(), Event.Priority.Normal, this);
pm.registerEvent(Type.PLAYER_BUCKET_FILL, lbPlayerListener, Event.Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, lbPlayerListener, Event.Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_JOIN, lbPlayerListener, Event.Priority.Normal, this);
pm.registerEvent(Type.BLOCK_BREAK, lbBlockListener, Event.Priority.Monitor, this);
pm.registerEvent(Type.BLOCK_PLACE, lbBlockListener, Event.Priority.Monitor, this);
if (config.logBlockCreations) {
pm.registerEvent(Type.BLOCK_PLACE, lbBlockListener, Event.Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, lbPlayerListener, Event.Priority.Monitor, this);
}
if (config.logBlockDestroyings) {
pm.registerEvent(Type.BLOCK_BREAK, lbBlockListener, Event.Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_BUCKET_FILL, lbPlayerListener, Event.Priority.Monitor, this);
}
if (config.logSignTexts)
pm.registerEvent(Type.SIGN_CHANGE, lbBlockListener, Event.Priority.Monitor, this);
if (config.logFire)