diff --git a/src/de/diddiz/LogBlock/BlockChange.java b/src/de/diddiz/LogBlock/BlockChange.java index fb04719..5899559 100644 --- a/src/de/diddiz/LogBlock/BlockChange.java +++ b/src/de/diddiz/LogBlock/BlockChange.java @@ -74,6 +74,8 @@ public class BlockChange implements LookupCacheElement msg.append("pressed " + materialName(type)); else if (type == 92) msg.append("ate a piece of " + materialName(type)); + else if (type == 25 || type == 93 || type == 94) + msg.append("changed " + materialName(type)); } else if (type == 0) msg.append("destroyed " + materialName(replaced, data)); else if (replaced == 0) diff --git a/src/de/diddiz/LogBlock/LBPlayerListener.java b/src/de/diddiz/LogBlock/LBPlayerListener.java index 89069d8..b6203d4 100644 --- a/src/de/diddiz/LogBlock/LBPlayerListener.java +++ b/src/de/diddiz/LogBlock/LBPlayerListener.java @@ -1,6 +1,7 @@ package de.diddiz.LogBlock; import java.util.Map; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; @@ -43,12 +44,35 @@ class LBPlayerListener extends PlayerListener if (!event.isCancelled() && wcfg != null && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) { final int type = event.getClickedBlock().getTypeId(); final Player player = event.getPlayer(); - if (wcfg.isLogging(Logging.SWITCHINTERACT) && (type == 69 || type == 77)) - consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)0); - else if (wcfg.isLogging(Logging.DOORINTERACT) && (type == 64 || type == 96 || type == 107 && event.getAction() == Action.RIGHT_CLICK_BLOCK)) - consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)((event.getClickedBlock().getData() & 4) / 4)); - else if (wcfg.isLogging(Logging.CAKEEAT) && type == 92 && player.getHealth() < player.getMaxHealth()) - consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)0); + final Location loc = event.getClickedBlock().getLocation(); + switch (type) { + case 69: + case 77: + if (wcfg.isLogging(Logging.SWITCHINTERACT)) + consumer.queueBlock(player.getName(), loc, type, type, (byte)0); + break; + case 107: + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + break; + case 64: + case 96: + if (wcfg.isLogging(Logging.DOORINTERACT)) + consumer.queueBlock(player.getName(), loc, type, type, (byte)((event.getClickedBlock().getData() & 4) / 4)); + break; + case 92: + if (wcfg.isLogging(Logging.CAKEEAT) && player.getFoodLevel() < 20) + consumer.queueBlock(player.getName(), loc, 92, 92, (byte)0); + break; + case 25: + if (wcfg.isLogging(Logging.NOTEBLOCKINTERACT)) + consumer.queueBlock(player.getName(), loc, 25, 25, (byte)0); + break; + case 93: + case 94: + if (wcfg.isLogging(Logging.DIODEINTERACT) && event.getAction() == Action.RIGHT_CLICK_BLOCK) + consumer.queueBlock(player.getName(), loc, type, type, (byte)0); + break; + } } } diff --git a/src/de/diddiz/LogBlock/Logging.java b/src/de/diddiz/LogBlock/Logging.java index 7fcb8ba..08e1f5c 100644 --- a/src/de/diddiz/LogBlock/Logging.java +++ b/src/de/diddiz/LogBlock/Logging.java @@ -1,7 +1,7 @@ package de.diddiz.LogBlock; public enum Logging { - BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT, TNTEXPLOSION(true), CREEPEREXPLOSION(true), GHASTFIREBALLEXPLOSION(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY, LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT, SWITCHINTERACT, CAKEEAT, ENDERMEN; + BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT, TNTEXPLOSION(true), CREEPEREXPLOSION(true), GHASTFIREBALLEXPLOSION(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY, LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT, SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT; public static int length = Logging.values().length;