summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-08-02 20:24:56 +1000
committermd_5 <git@md-5.net>2018-08-02 20:24:56 +1000
commit80c43fc1deaa164a5eb85aa779eb26a7deca7287 (patch)
treed8581a51c9bcf1e75d83c525edb21f9d2e8ea24d /src/main/java/org
parent272426acd7cfb50978f478f49d835c8541da2a4e (diff)
downloadcraftbukkit-80c43fc1deaa164a5eb85aa779eb26a7deca7287.tar
craftbukkit-80c43fc1deaa164a5eb85aa779eb26a7deca7287.tar.gz
craftbukkit-80c43fc1deaa164a5eb85aa779eb26a7deca7287.tar.lz
craftbukkit-80c43fc1deaa164a5eb85aa779eb26a7deca7287.tar.xz
craftbukkit-80c43fc1deaa164a5eb85aa779eb26a7deca7287.zip
SPIGOT-4214: Catch attempts to create BlockData for items
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 882e39be..cfe5903c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -417,6 +417,8 @@ public class CraftBlockData implements BlockData {
}
public static CraftBlockData newData(Material material, String data) {
+ Preconditions.checkArgument(material == null || material.isBlock(), "Cannot get data for not block %s", material);
+
IBlockData blockData;
Block block = CraftMagicNumbers.getBlock(material);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 045b5b41..3474536f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -84,6 +84,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
for (Material material : Material.values()) {
MinecraftKey key = key(material);
+ // TODO: only register if block/item?
MATERIAL_ITEM.put(material, Item.REGISTRY.get(key));
MATERIAL_BLOCK.put(material, Block.REGISTRY.get(key));
}