Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
}
}
}
@@ -261,13 +_,53 @@
@@ -261,21 +_,70 @@

public boolean destroyBlock(final BlockPos pos) {
BlockState state = this.level.getBlockState(pos);
Expand All @@ -200,6 +200,11 @@
+ org.bukkit.block.Block bblock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, pos);
+ org.bukkit.event.block.BlockBreakEvent event = null;
+ if (this.player instanceof ServerPlayer) {
+ // Paper start - Ensure BlockBreakEvent only fires for valid adventure breaks - moved up from below
+ if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
+ return false;
+ }
+ // Paper end - Ensure BlockBreakEvent only fires for valid adventure breaks
+ // Sword + Creative mode pre-cancel
+ boolean canAttackBlock = !this.player.getMainHandItem().canDestroyBlock(state, this.level, pos, this.player);
+ event = new org.bukkit.event.block.BlockBreakEvent(bblock, this.player.getBukkitEntity());
Expand Down Expand Up @@ -248,7 +253,9 @@
this.level.sendBlockUpdated(pos, state, state, Block.UPDATE_ALL);
return false;
}
@@ -276,6 +_,10 @@

- if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
Comment thread
JavierFlores09 marked this conversation as resolved.
+ if (false && this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { // Paper - Ensure BlockBreakEvent only fires for valid adventure breaks - moved up
return false;
}

Expand Down
Loading