From 4e106827482b540793e0f6f40a6312854cd83871 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 20 Dec 2018 18:46:52 +0000 Subject: [PATCH] A few minor fixes --- .../plotsquared/bukkit/util/BukkitChunkManager.java | 11 +++++------ .../plotsquared/bukkit/util/BukkitLegacyMappings.java | 6 +++--- .../plotsquared/plot/object/StringPlotBlock.java | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index ebaf47012..6e2608c22 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -297,7 +297,8 @@ public class BukkitChunkManager extends ChunkManager { if (id != null) { value.setBlock(x, y, z, id); } else { - value.setBlock(x, y, z, PlotBlock.get("air")); + value.setBlock(x, y, z, + PlotBlock.get("air")); } } for (int y = Math.min(128, ids.length); @@ -1095,14 +1096,13 @@ public class BukkitChunkManager extends ChunkManager { Block block = world.getBlockAt(x, y, z); Material id = block.getType(); if (storeNormal) { - int typeId = id.getId(); - if (typeId == 0) { + if (id.name().contains("AIR")) { ids[y] = StringPlotBlock.EVERYTHING; } else { - ids[y] = PlotBlock.get((short) typeId, block.getData()); + ids[y] = PlotBlock.get(id.name()); } } - if (!id.equals(Material.AIR)) { + if (!id.name().contains("AIR")) { try { BlockLoc bl = new BlockLoc(x + offsetX, y, z + offsetZ); if (block.getState() instanceof InventoryHolder) { @@ -1136,7 +1136,6 @@ public class BukkitChunkManager extends ChunkManager { this.brewingStandContents.put(bl, invBre); break; case FURNACE: - case LEGACY_BURNING_FURNACE: Furnace furnace = (Furnace) inventoryHolder; short burn = furnace.getBurnTime(); short cook = furnace.getCookTime(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java index b92b6edfe..1e67b3463 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java @@ -729,9 +729,9 @@ public class BukkitLegacyMappings extends LegacyMappings { } } } - PlotBlock plotBlock = fromStringToLegacy(workingString); - if (plotBlock != null) { - return plotBlock; + PlotBlock plotBlock; + if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.keySet().contains(workingString.toLowerCase())) { + return PlotBlock.get(workingString); } else if ((plotBlock = fromLegacyToString(workingString)) != null) { return plotBlock; } else { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java index 0b700610a..7fcb07907 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/StringPlotBlock.java @@ -11,7 +11,7 @@ import java.util.Map; public class StringPlotBlock extends PlotBlock { - public static final PlotBlock EVERYTHING = new StringPlotBlock(""); + public static final PlotBlock EVERYTHING = new StringPlotBlock("air"); private static final Map STRING_PLOT_BLOCK_CACHE = new HashMap<>(); @Getter private final String nameSpace; @Getter private final String itemId;