diff --git a/pom.xml b/pom.xml index 134ac2c2..fab5d6de 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Jobs jobs - 4.5.1 + 4.7.2 Jobs http://maven.apache.org @@ -16,7 +16,7 @@ org.spigotmc spigot-api - 1.12-R0.1-SNAPSHOT + 1.13-R0.1-SNAPSHOT provided diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java index 92283bba..844fd7f4 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java @@ -18,6 +18,7 @@ import org.bukkit.inventory.Recipe; import org.bukkit.inventory.meta.SkullMeta; import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.VersionChecker.Version; public class ItemManager { @@ -26,10 +27,10 @@ public class ItemManager { static HashMap byBukkitName = new HashMap<>(); static HashMap byMojangName = new HashMap<>(); static HashMap byMaterial = new HashMap<>(); - static Version version; + static final Version version = Jobs.getVersionCheckManager().getVersion(); public static void load() { - version = Jobs.getVersionCheckManager().getVersion(); + for (CMIMaterial one : CMIMaterial.values()) { if (one == null) continue; @@ -2187,13 +2188,17 @@ public class ItemManager { } public static boolean isDye(Material mat) { + Debug.D("ss1"); CMIMaterial m = CMIMaterial.get(mat); + Debug.D("ss2"); if (m == null) return false; + Debug.D("ss3"); return m.isDye(); } public boolean isDye() { + Debug.D("ss4"); switch (this) { case INK_SAC: case ROSE_RED: @@ -2254,70 +2259,7 @@ public class ItemManager { } public static SlabType getSlabType(Block block) { - if (!isSlab(block.getType())) - return SlabType.NOTSLAB; - - if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)) { - if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) { - org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData(); - switch (slab.getType()) { - case TOP: - return SlabType.TOP; - case BOTTOM: - return SlabType.BOTTOM; - case DOUBLE: - return SlabType.DOUBLE; - } - - } - return SlabType.NOTSLAB; - } - s: if (block.getType().name().contains("STEP")) { - switch (CMIMaterial.get(block).getLegacyId()) { - case 44: - switch (block.getData()) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - return SlabType.BOTTOM; - default: - return SlabType.DOUBLE; - } - case 126: - switch (block.getData()) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - return SlabType.BOTTOM; - default: - return SlabType.DOUBLE; - } - case 182: - switch (block.getData()) { - case 0: - return SlabType.BOTTOM; - default: - return SlabType.DOUBLE; - } - case 205: - switch (block.getData()) { - case 0: - return SlabType.BOTTOM; - default: - return SlabType.DOUBLE; - } - } - } - - return SlabType.NOTSLAB; + return checkSlab(block); } public boolean equals(Material mat) { @@ -2355,6 +2297,71 @@ public class ItemManager { } } + private static SlabType checkSlab(Block block) throws NoClassDefFoundError { + if (!CMIMaterial.isSlab(block.getType())) + return SlabType.NOTSLAB; + + if (version.isEqualOrHigher(Version.v1_13_R1)) { + if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) { + org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData(); + org.bukkit.block.data.type.Slab.Type t = slab.getType(); + if (t.equals(org.bukkit.block.data.type.Slab.Type.TOP)) + return SlabType.TOP; + if (t.equals(org.bukkit.block.data.type.Slab.Type.BOTTOM)) + return SlabType.BOTTOM; + if (t.equals(org.bukkit.block.data.type.Slab.Type.DOUBLE)) + return SlabType.DOUBLE; + } + return SlabType.NOTSLAB; + } + if (block.getType().name().contains("STEP")) { + switch (CMIMaterial.get(block).getLegacyId()) { + case 44: + switch (block.getData()) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return SlabType.BOTTOM; + default: + return SlabType.DOUBLE; + } + case 126: + switch (block.getData()) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return SlabType.BOTTOM; + default: + return SlabType.DOUBLE; + } + case 182: + switch (block.getData()) { + case 0: + return SlabType.BOTTOM; + default: + return SlabType.DOUBLE; + } + case 205: + switch (block.getData()) { + case 0: + return SlabType.BOTTOM; + default: + return SlabType.DOUBLE; + } + } + } + + return SlabType.NOTSLAB; + } + public enum SlabType { TOP, BOTTOM, diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 93ef7b41..403e5767 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -574,6 +574,7 @@ public class JobsPaymentListener implements Listener { if (sourceItems[i] == null) continue; + Debug.D("ss"); if (CMIMaterial.isDye(sourceItems[i].getType())) DyeStack.add(sourceItems[i]); diff --git a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java index 7fbe78f7..f20a039d 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java @@ -92,8 +92,8 @@ public class VersionChecker { return getValue() >= version.getValue(); } - public static boolean isCurrentEqualOrHigher(Version version) { - return version.getValue() >= version.getValue(); + public static boolean isCurrentEqualOrHigher(Version v) { + return version.getValue() >= v.getValue(); } }