diff --git a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index ae875af33..4537d7b35 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -46,7 +46,7 @@ import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.schematic.PlotItem; -import com.plotsquared.bukkit.object.schematic.StateWrapper; +import com.plotsquared.object.schematic.StateWrapper; public abstract class SchematicHandler { public static SchematicHandler manager; @@ -442,12 +442,17 @@ public abstract class SchematicHandler { try { List blockStates = ListTag.class.cast(tagMap.get("TileEntities")).getValue(); for (Tag stateTag : blockStates) { - CompoundTag ct = ((CompoundTag) stateTag); - Map state = ct.getValue(); - short x = IntTag.class.cast(state.get("x")).getValue().shortValue(); - short y = IntTag.class.cast(state.get("y")).getValue().shortValue(); - short z = IntTag.class.cast(state.get("z")).getValue().shortValue(); - new StateWrapper(ct).restoreTag(x, y, z, schem); + try { + CompoundTag ct = ((CompoundTag) stateTag); + Map state = ct.getValue(); + short x = IntTag.class.cast(state.get("x")).getValue().shortValue(); + short y = IntTag.class.cast(state.get("y")).getValue().shortValue(); + short z = IntTag.class.cast(state.get("z")).getValue().shortValue(); + new StateWrapper(ct).restoreTag(x, y, z, schem); + } + catch (Exception e) { + e.printStackTrace(); + } } } catch (Exception e) { diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java b/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java index 0ad812071..62f32ae2b 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java @@ -44,7 +44,7 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.object.schematic.StateWrapper; +import com.plotsquared.object.schematic.StateWrapper; /** * Schematic Handler diff --git a/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java b/src/main/java/com/plotsquared/object/schematic/StateWrapper.java similarity index 93% rename from src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java rename to src/main/java/com/plotsquared/object/schematic/StateWrapper.java index aaadc587e..97fdfc88e 100644 --- a/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java +++ b/src/main/java/com/plotsquared/object/schematic/StateWrapper.java @@ -1,4 +1,4 @@ -package com.plotsquared.bukkit.object.schematic; +package com.plotsquared.object.schematic; import java.util.ArrayList; import java.util.HashMap; @@ -92,6 +92,14 @@ public class StateWrapper { return tags; } + public Map serializeItem(org.spongepowered.api.item.inventory.ItemStack item) { + Map data = new HashMap(); + + // FIXME serialize sponge item + + return data; + } + public Map serializeItem(ItemStack item) { Map data = new HashMap(); data.put("id", new ShortTag("id", (short) item.getTypeId()));