-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
This server is running CraftBukkit version 3284-Spigot-3892929-0ebef35 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)
-
Yes
This is a bug introduced in 1.17
When selectively cancelling BlockPhysicsEvent, it's not ensured that it will indeed properly cancel.
I've tested this as far with Redstone Torch and Wall Sign.
The BlockPhysicsEvent fires as expected, however after being cancelled my belief is that there's another captured block state that is fired after that, and takes effect if you don't cancel it as well. I don't understand much about the current code of nms.
In this case, the second BlockPhysicsEvent will fire and report the block as air, the changed material as air, and the source block as air. No mention of redstone torches.
If the air physics events are not cancelled, the redstone torch will break as if it was never cancelled.
@EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { Block b = event.getBlock(); if (b.getType() == Material.REDSTONE_TORCH || event.getSourceBlock().getType() == Material.REDSTONE_TORCH || event.getChangedType() == Material.REDSTONE_TORCH) { Bukkit.broadcastMessage("Cancelled redstone torch!"); event.setCancelled(true); } }