SPIGOT-6852: BlockReceiveGameEvent#getBlock returning wrong block

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-12-14 07:52:43 +11:00
parent ef17571a38
commit 94c2fa1b14

View file

@ -21,7 +21,7 @@
- if (!this.config.shouldListen(world, this, blockposition, gameevent, entity)) {
+ // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(world, this, blockposition, gameevent, entity);
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), CraftBlock.at(world, blockposition), (entity == null) ? null : entity.getBukkitEntity());
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), CraftBlock.at(world, blockposition1), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {