SPIGOT-6852: BlockReceiveGameEvent#getBlock returning wrong block

This commit is contained in:
md_5 2021-12-14 07:52:43 +11:00
parent dad8517102
commit e36f7599d6
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -21,7 +21,7 @@
- if (!this.config.shouldListen(world, this, blockposition, gameevent, entity)) { - if (!this.config.shouldListen(world, this, blockposition, gameevent, entity)) {
+ // CraftBukkit start + // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(world, this, blockposition, gameevent, entity); + 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); + event.setCancelled(defaultCancel);
+ world.getCraftServer().getPluginManager().callEvent(event); + world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) { + if (event.isCancelled()) {