Add Preconditions check in CraftBlock#setType() to verify Material is block

This commit is contained in:
2008Choco 2024-12-23 23:43:55 -05:00
parent 76fd7c056d
commit 6ab95355b2
No known key found for this signature in database
GPG key ID: 6A35B5CF6ECEA235

View file

@ -174,6 +174,7 @@ public class CraftBlock implements Block {
@Override
public void setType(Material type, boolean applyPhysics) {
Preconditions.checkArgument(type != null, "Material cannot be null");
Preconditions.checkArgument(type.isBlock(), "Material must be a block type. Given %s, which is not a block", type.getKey());
setBlockData(type.createBlockData(), applyPhysics);
}