forked from LogBlock/LogBlock
@@ -26,7 +26,7 @@ public class BlockPlaceLogging extends LoggingListener
|
|||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||||
if (wcfg != null && wcfg.isLogging(Logging.BLOCKPLACE)) {
|
if (wcfg != null && wcfg.isLogging(Logging.BLOCKPLACE)) {
|
||||||
final int type = event.getBlock().getTypeId();
|
final Material type = event.getBlock().getType();
|
||||||
final BlockState before = event.getBlockReplacedState();
|
final BlockState before = event.getBlockReplacedState();
|
||||||
final BlockState after = event.getBlockPlaced().getState();
|
final BlockState after = event.getBlockPlaced().getState();
|
||||||
final String playerName = event.getPlayer().getName();
|
final String playerName = event.getPlayer().getName();
|
||||||
@@ -53,11 +53,11 @@ public class BlockPlaceLogging extends LoggingListener
|
|||||||
if (y != 0) {
|
if (y != 0) {
|
||||||
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
||||||
// Run this check to avoid false positives
|
// Run this check to avoid false positives
|
||||||
if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getTypeId())) {
|
if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getType())) {
|
||||||
if (finalLoc.getBlock().getType() == Material.AIR || finalLoc.equals(event.getBlock().getLocation())) {
|
if (finalLoc.getBlock().getType() == Material.AIR || finalLoc.equals(event.getBlock().getLocation())) {
|
||||||
consumer.queueBlockPlace(playerName, finalLoc, type, event.getBlock().getData());
|
consumer.queueBlockPlace(playerName, finalLoc, type.getId(), event.getBlock().getData());
|
||||||
} else {
|
} else {
|
||||||
consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), type, event.getBlock().getData());
|
consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), type.getId(), event.getBlock().getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,8 +65,7 @@ public class BlockPlaceLogging extends LoggingListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Sign logging is handled elsewhere
|
//Sign logging is handled elsewhere
|
||||||
if (wcfg.isLogging(Logging.SIGNTEXT) && (type == 63 || type == 68))
|
if (wcfg.isLogging(Logging.SIGNTEXT) && (type.getId() == 63 || type.getId() == 68)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
//Delay queuing by one tick to allow data to be updated
|
//Delay queuing by one tick to allow data to be updated
|
||||||
LogBlock.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(LogBlock.getInstance(), new Runnable()
|
LogBlock.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(LogBlock.getInstance(), new Runnable()
|
||||||
|
@@ -332,7 +332,7 @@ public class BukkitUtils
|
|||||||
return true;
|
return true;
|
||||||
} else if (mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA) { // Fluids
|
} else if (mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA) { // Fluids
|
||||||
return true;
|
return true;
|
||||||
} else if (getFallingEntityKillers().contains(mat.getId()) || mat == Material.FIRE || mat == Material.VINE || mat == Material.LONG_GRASS || mat == Material.DEAD_BUSH) { // Misc.
|
} else if (getFallingEntityKillers().contains(mat) || mat == Material.FIRE || mat == Material.VINE || mat == Material.LONG_GRASS || mat == Material.DEAD_BUSH) { // Misc.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@@ -32,7 +32,7 @@ public class LoggingUtil {
|
|||||||
Block checkBlock = origin.getRelative(BlockFace.UP);
|
Block checkBlock = origin.getRelative(BlockFace.UP);
|
||||||
int up = 0;
|
int up = 0;
|
||||||
final int highestBlock = checkBlock.getWorld().getHighestBlockYAt(checkBlock.getLocation());
|
final int highestBlock = checkBlock.getWorld().getHighestBlockYAt(checkBlock.getLocation());
|
||||||
while (BukkitUtils.getRelativeTopFallables().contains(checkBlock.getTypeId())) {
|
while (BukkitUtils.getRelativeTopFallables().contains(checkBlock.getType())) {
|
||||||
|
|
||||||
// Record this block as falling
|
// Record this block as falling
|
||||||
consumer.queueBlockBreak(playerName, checkBlock.getState());
|
consumer.queueBlockBreak(playerName, checkBlock.getState());
|
||||||
@@ -49,9 +49,9 @@ public class LoggingUtil {
|
|||||||
if (y != 0) {
|
if (y != 0) {
|
||||||
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
Location finalLoc = new Location(loc.getWorld(), x, y, z);
|
||||||
// Run this check to avoid false positives
|
// Run this check to avoid false positives
|
||||||
if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getTypeId())) {
|
if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getType())) {
|
||||||
finalLoc.add(0, up, 0); // Add this here after checking for block breakers
|
finalLoc.add(0, up, 0); // Add this here after checking for block breakers
|
||||||
if (finalLoc.getBlock().getType() == Material.AIR || BukkitUtils.getRelativeTopFallables().contains(finalLoc.getBlock().getTypeId())) {
|
if (finalLoc.getBlock().getType() == Material.AIR || BukkitUtils.getRelativeTopFallables().contains(finalLoc.getBlock().getType())) {
|
||||||
consumer.queueBlockPlace(playerName, finalLoc, checkBlock.getTypeId(), checkBlock.getData());
|
consumer.queueBlockPlace(playerName, finalLoc, checkBlock.getTypeId(), checkBlock.getData());
|
||||||
} else {
|
} else {
|
||||||
consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), checkBlock.getTypeId(), checkBlock.getData());
|
consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), checkBlock.getTypeId(), checkBlock.getData());
|
||||||
@@ -70,7 +70,7 @@ public class LoggingUtil {
|
|||||||
if (wcfg == null) return;
|
if (wcfg == null) return;
|
||||||
|
|
||||||
Block checkBlock = origin.getRelative(BlockFace.UP);
|
Block checkBlock = origin.getRelative(BlockFace.UP);
|
||||||
if (BukkitUtils.getRelativeTopBreakabls().contains(checkBlock.getTypeId())) {
|
if (BukkitUtils.getRelativeTopBreakabls().contains(checkBlock.getType())) {
|
||||||
if (wcfg.isLogging(Logging.SIGNTEXT) && checkBlock.getType() == Material.SIGN_POST) {
|
if (wcfg.isLogging(Logging.SIGNTEXT) && checkBlock.getType() == Material.SIGN_POST) {
|
||||||
consumer.queueSignBreak(playerName, (Sign) checkBlock.getState());
|
consumer.queueSignBreak(playerName, (Sign) checkBlock.getState());
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user