Skip to content

Commit

Permalink
Fix BlockBreakEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Nov 29, 2024
1 parent 372ec50 commit 3c65185
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public void handleBlockBreakAction(BlockPos blockposition, ServerboundPlayerActi
}

event = new BlockBreakEvent(bblock, this.player.getBukkitEntity());
banner$event.set(event);

// Sword + Creative mode pre-cancel
event.setCancelled(isSwordNoBreak);
Expand All @@ -304,6 +303,7 @@ public void handleBlockBreakAction(BlockPos blockposition, ServerboundPlayerActi
}

this.level.getCraftServer().getPluginManager().callEvent(event);
banner$event.set(event);

if (event.isCancelled()) {
if (isSwordNoBreak) {
Expand Down Expand Up @@ -344,8 +344,9 @@ public void handleBlockBreakAction(BlockPos blockposition, ServerboundPlayerActi

// Drop event experience
if (this.level.removeBlock(pos, false) && banner$event.get() != null) {
this.level.getBlockState(pos).getBlock().popExperience(this.level, pos, banner$event.getAndSet(null).getExpToDrop());
this.level.getBlockState(pos).getBlock().popExperience(this.level, pos, banner$event.get().getExpToDrop());
}
banner$event.set(null);
cir.setReturnValue(true);
}

Expand Down

0 comments on commit 3c65185

Please sign in to comment.