Delay queuing of stairs and blocks by 1 tick to allow data to update. Fixes #146 and #143

This commit is contained in:
Ammar Askar
2012-07-11 16:40:34 +01:00
committed by md_5
parent 9e16d42a08
commit ffa0bc5ebf

View File

@@ -26,12 +26,27 @@ public class BlockPlaceLogging extends LoggingListener
final int type = event.getBlock().getTypeId();
final BlockState before = event.getBlockReplacedState();
final BlockState after = event.getBlockPlaced().getState();
final String playerName = event.getPlayer().getName();
if (type == 0 && event.getItemInHand() != null) {
if (event.getItemInHand().getTypeId() == 51)
return;
after.setTypeId(event.getItemInHand().getTypeId());
after.setData(new MaterialData(event.getItemInHand().getTypeId()));
}
// Delay queuing of stairs and blocks by 1 tick to allow the raw data to update
if (type == 53 || type == 67 || type == 108 || type == 109 || type == 114 || type == 128 || type == 134 || type == 135 || type == 136 || type == 26) {
LogBlock.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(LogBlock.getInstance(), new Runnable()
{
@Override
public void run() {
if (before.getTypeId() == 0)
consumer.queueBlockPlace(playerName, after);
else
consumer.queueBlockReplace(playerName, before, after);
}
}, 1L);
return;
}
if (wcfg.isLogging(Logging.SIGNTEXT) && (type == 63 || type == 68))
return;
if (before.getTypeId() == 0)