forked from LogBlock/LogBlock
Added logging for furnaces and dispencer
This commit is contained in:
@@ -50,16 +50,19 @@ public class BlockStats implements Runnable
|
||||
player.sendMessage(ChatColor.DARK_AQUA + "Block history (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + "): ");
|
||||
while (rs.next()) {
|
||||
String msg = formatter.format(rs.getTimestamp("date")) + " " + rs.getString("playername") + " ";
|
||||
if ((rs.getInt("type") == 63 || rs.getInt("type") == 68) && rs.getString("signtext") != null)
|
||||
int type = rs.getInt("type");
|
||||
int replaced = rs.getInt("replaced");
|
||||
if ((type == 63 || type == 68) && rs.getString("signtext") != null)
|
||||
msg += "created " + rs.getString("signtext");
|
||||
else if (rs.getInt("type") == 54 && rs.getInt("replaced") == 54)
|
||||
msg += "looked inside";
|
||||
else if (rs.getInt("type") == 0)
|
||||
msg += "destroyed " + getMaterialName(rs.getInt("replaced"));
|
||||
else if (rs.getInt("replaced") == 0)
|
||||
msg += "created " + getMaterialName(rs.getInt("type"));
|
||||
else if (type == replaced) {
|
||||
if (type == 23 || type == 54 || type == 61)
|
||||
msg += "looked inside " + getMaterialName(type);
|
||||
} else if (type == 0)
|
||||
msg += "destroyed " + getMaterialName(replaced);
|
||||
else if (replaced == 0)
|
||||
msg += "created " + getMaterialName(type);
|
||||
else
|
||||
msg += "replaced " + getMaterialName(rs.getInt("replaced")) + " with " + getMaterialName(rs.getInt("type"));
|
||||
msg += "replaced " + getMaterialName(replaced) + " with " + getMaterialName(type);
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
hist = true;
|
||||
}
|
||||
|
@@ -365,7 +365,7 @@ public class LogBlock extends JavaPlugin
|
||||
}
|
||||
|
||||
private void queueBlock(Player player, Block block, short inType, byte inAmount, short outType, byte outAmount) {
|
||||
queueBlock(player.getName(), block, 54, 54, (byte)0, null, new ChestAccess(inType, inAmount, outType, outAmount));
|
||||
queueBlock(player.getName(), block, block.getTypeId(), block.getTypeId(), (byte)0, null, new ChestAccess(inType, inAmount, outType, outAmount));
|
||||
}
|
||||
|
||||
private void queueBlock(String playerName, Block block, int typeBefore, int typeAfter, byte data, String signtext, ChestAccess ca) {
|
||||
@@ -474,7 +474,7 @@ public class LogBlock extends JavaPlugin
|
||||
{
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getClickedBlock().getType() == Material.CHEST)) {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getClickedBlock().getType() == Material.CHEST || event.getClickedBlock().getType() == Material.FURNACE ||event.getClickedBlock().getType() == Material.DISPENSER)) {
|
||||
queueBlock(event.getPlayer(), event.getClickedBlock(), (short)0, (byte)0, (short)0, (byte)0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user