Added diode and noteblock logging.

Fixed cake logging.
This commit is contained in:
Robin Kupper
2011-11-29 14:42:29 +01:00
parent de24cc0f7e
commit 1985c655c6
3 changed files with 33 additions and 7 deletions

View File

@@ -74,6 +74,8 @@ public class BlockChange implements LookupCacheElement
msg.append("pressed " + materialName(type)); msg.append("pressed " + materialName(type));
else if (type == 92) else if (type == 92)
msg.append("ate a piece of " + materialName(type)); 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) } else if (type == 0)
msg.append("destroyed " + materialName(replaced, data)); msg.append("destroyed " + materialName(replaced, data));
else if (replaced == 0) else if (replaced == 0)

View File

@@ -1,6 +1,7 @@
package de.diddiz.LogBlock; package de.diddiz.LogBlock;
import java.util.Map; import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; 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)) { if (!event.isCancelled() && wcfg != null && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
final int type = event.getClickedBlock().getTypeId(); final int type = event.getClickedBlock().getTypeId();
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (wcfg.isLogging(Logging.SWITCHINTERACT) && (type == 69 || type == 77)) final Location loc = event.getClickedBlock().getLocation();
consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)0); switch (type) {
else if (wcfg.isLogging(Logging.DOORINTERACT) && (type == 64 || type == 96 || type == 107 && event.getAction() == Action.RIGHT_CLICK_BLOCK)) case 69:
consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)((event.getClickedBlock().getData() & 4) / 4)); case 77:
else if (wcfg.isLogging(Logging.CAKEEAT) && type == 92 && player.getHealth() < player.getMaxHealth()) if (wcfg.isLogging(Logging.SWITCHINTERACT))
consumer.queueBlock(player.getName(), event.getClickedBlock().getLocation(), type, type, (byte)0); 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;
}
} }
} }

View File

@@ -1,7 +1,7 @@
package de.diddiz.LogBlock; package de.diddiz.LogBlock;
public enum Logging { 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; public static int length = Logging.values().length;