Add additional validation to Player#breakBlock

This commit is contained in:
md_5 2021-06-13 08:27:57 +10:00
parent bc835ae644
commit dd4bec5f13
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -536,6 +536,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public boolean breakBlock(Block block) { public boolean breakBlock(Block block) {
Preconditions.checkArgument(block != null, "Block cannot be null");
Preconditions.checkArgument(block.getWorld().equals(getWorld()), "Cannot break blocks across worlds");
return getHandle().gameMode.breakBlock(new BlockPosition(block.getX(), block.getY(), block.getZ())); return getHandle().gameMode.breakBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()));
} }