forked from LogBlock/LogBlock
Fixed door logging
This commit is contained in:
@@ -73,6 +73,18 @@ public class LoggingUtil {
|
||||
if (BukkitUtils.getRelativeTopBreakabls().contains(checkBlock.getType())) {
|
||||
if (wcfg.isLogging(Logging.SIGNTEXT) && checkBlock.getType() == Material.SIGN_POST) {
|
||||
consumer.queueSignBreak(playerName, (Sign) checkBlock.getState());
|
||||
} else if (checkBlock.getType() == Material.IRON_DOOR || checkBlock.getType() == Material.WOOD_DOOR) {
|
||||
Block doorBlock = checkBlock;
|
||||
// If the doorBlock is the top half a door the player simply punched a door
|
||||
// this will be handled later.
|
||||
if (doorBlock.getData() != 8 && doorBlock.getData() != 9) {
|
||||
doorBlock = doorBlock.getRelative(BlockFace.UP);
|
||||
// Fall back check just in case the top half wasn't a door
|
||||
if (doorBlock.getType() == Material.IRON_DOOR || doorBlock.getType() == Material.WOOD_DOOR) {
|
||||
consumer.queueBlockBreak(playerName, doorBlock.getState());
|
||||
}
|
||||
consumer.queueBlockBreak(playerName, checkBlock.getState());
|
||||
}
|
||||
} else {
|
||||
consumer.queueBlockBreak(playerName, checkBlock.getState());
|
||||
}
|
||||
@@ -142,6 +154,23 @@ public class LoggingUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Special door check
|
||||
if (origin.getType() == Material.IRON_DOOR || origin.getType() == Material.WOOD_DOOR) {
|
||||
Block doorBlock = origin;
|
||||
|
||||
// Up or down?
|
||||
if (origin.getData() != 8 && origin.getData() != 9) {
|
||||
doorBlock = doorBlock.getRelative(BlockFace.UP);
|
||||
} else {
|
||||
doorBlock = doorBlock.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
if (doorBlock.getType() == Material.IRON_DOOR || doorBlock.getType() == Material.WOOD_DOOR) {
|
||||
consumer.queueBlockBreak(playerName, doorBlock.getState());
|
||||
}
|
||||
}
|
||||
|
||||
// Do this down here so that the block is added after blocks sitting on it
|
||||
consumer.queueBlockBreak(playerName, origin.getState());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user