Add additional validation to Player#breakBlock

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-06-13 08:27:57 +10:00
parent c799ab1f6e
commit 472f590189

View file

@ -536,6 +536,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
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()));
}