Added Logging for Comparator interaction

This commit is contained in:
Dark Arc
2013-03-29 20:26:31 -04:00
parent d448f90e2d
commit 05c9a6d947
4 changed files with 16 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ public class BlockChange implements LookupCacheElement
msg.append("pressed ").append(materialName(type));
else if (type == 92)
msg.append("ate a piece of ").append(materialName(type));
else if (type == 25 || type == 93 || type == 94)
else if (type == 25 || type == 93 || type == 94 || type == 149 || type == 150)
msg.append("changed ").append(materialName(type));
} else if (type == 0)
msg.append("destroyed ").append(materialName(replaced, data));

View File

@@ -149,7 +149,7 @@ public class LogBlock extends JavaPlugin
if (isLogging(Logging.CHESTACCESS)) {
pm.registerEvents(new ChestAccessLogging(this), this);
}
if (isLogging(Logging.SWITCHINTERACT) || isLogging(Logging.DOORINTERACT) || isLogging(Logging.CAKEEAT) || isLogging(Logging.DIODEINTERACT) || isLogging(Logging.NOTEBLOCKINTERACT))
if (isLogging(Logging.SWITCHINTERACT) || isLogging(Logging.DOORINTERACT) || isLogging(Logging.CAKEEAT) || isLogging(Logging.DIODEINTERACT) || isLogging(Logging.COMPARATORINTERACT) || isLogging(Logging.NOTEBLOCKINTERACT))
pm.registerEvents(new InteractLogging(this), this);
if (isLogging(Logging.KILL))
pm.registerEvents(new KillLogging(this), this);

View File

@@ -5,9 +5,10 @@ public enum Logging
BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT, TNTEXPLOSION(true), CREEPEREXPLOSION(true),
GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY,
LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT,
SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW,
WITHER(true), WITHER_SKULL(true),
SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, COMPARATORINTERACT,
NATURALSTRUCTUREGROW, WITHER(true), WITHER_SKULL(true),
BONEMEALSTRUCTUREGROW, WORLDEDIT, TNTMINECARTEXPLOSION(true);
public static final int length = Logging.values().length;
private final boolean defaultEnabled;

View File

@@ -21,7 +21,7 @@ public class InteractLogging extends LoggingListener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
final WorldConfig wcfg = getWorldConfig(event.getPlayer().getWorld());
if (wcfg != null && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
if (wcfg != null) {
final Material type = event.getClickedBlock().getType();
final int typeId = type.getId();
final byte blockData = event.getClickedBlock().getData();
@@ -32,23 +32,21 @@ public class InteractLogging extends LoggingListener
case LEVER:
case WOOD_BUTTON:
case STONE_BUTTON:
if (wcfg.isLogging(Logging.SWITCHINTERACT))
if (wcfg.isLogging(Logging.SWITCHINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK)
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
break;
case FENCE_GATE:
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
break;
case WOODEN_DOOR:
case TRAP_DOOR:
if (wcfg.isLogging(Logging.DOORINTERACT))
if (wcfg.isLogging(Logging.DOORINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK)
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
break;
case CAKE_BLOCK:
if (wcfg.isLogging(Logging.CAKEEAT) && player.getFoodLevel() < 20)
if (wcfg.isLogging(Logging.CAKEEAT) && event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getFoodLevel() < 20)
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
break;
case NOTE_BLOCK:
if (wcfg.isLogging(Logging.NOTEBLOCKINTERACT))
if (wcfg.isLogging(Logging.NOTEBLOCKINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK)
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
break;
case DIODE_BLOCK_OFF:
@@ -56,6 +54,12 @@ public class InteractLogging extends LoggingListener
if (wcfg.isLogging(Logging.DIODEINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK)
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
break;
case REDSTONE_COMPARATOR_OFF:
case REDSTONE_COMPARATOR_ON:
if (wcfg.isLogging(Logging.COMPARATORINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
consumer.queueBlock(player.getName(), loc, typeId, typeId, blockData);
}
break;
}
}
}