diff --git a/pom.xml b/pom.xml index f67cd5d9..cd383713 100644 --- a/pom.xml +++ b/pom.xml @@ -182,14 +182,14 @@ 1.8 - - - - - - - - + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + C:\Users\Arte\Desktop\Server 1.14\plugins + + diff --git a/src/main/java/com/gamingmesh/jobs/Reflections.java b/src/main/java/com/gamingmesh/jobs/Reflections.java index c31bc5b3..5707024b 100644 --- a/src/main/java/com/gamingmesh/jobs/Reflections.java +++ b/src/main/java/com/gamingmesh/jobs/Reflections.java @@ -78,47 +78,6 @@ public class Reflections { return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); } - public String getItemMinecraftName(ItemStack item) { - try { - Object nmsStack = asNMSCopy(item); - Method itemMeth = Item.getMethod("getById", int.class); - @SuppressWarnings("deprecation") - Object res = itemMeth.invoke(Item, item.getType().getId()); - - String ff = "b"; - switch (Jobs.getVersionCheckManager().getVersion()) { - case v1_10_R1: - case v1_9_R1: - case v1_9_R2: - case v1_8_R1: - case v1_8_R3: - case v1_8_R2: - ff = "a"; - break; - case v1_11_R1: - case v1_12_R1: - case v1_13_R2: - case v1_13_R1: - ff = "b"; - break; - case v1_7_R1: - case v1_7_R2: - case v1_7_R3: - case v1_7_R4: - ff = "n"; - break; - default: - break; - } - - Method meth2 = res.getClass().getMethod(ff, IStack); - Object name = meth2.invoke(res, nmsStack); - return name.toString(); - } catch (Throwable e) { - return item != null ? item.getType().name() : ""; - } - } - public ItemStack removeNbt(ItemStack item, String base, String path) { if (item == null) return null; diff --git a/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java b/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java index 366cfc6a..2b987d6f 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java @@ -33,8 +33,11 @@ import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial; public class JobLimitedItems { private String node; + @Deprecated private int id; + @Deprecated private int data; + CMIMaterial mat; private int amount; private String name; private List lore; @@ -58,8 +61,8 @@ public class JobLimitedItems { public ItemStack getItemStack(Player player) { try { - CMIMaterial cm = CMIMaterial.get(id, data); - ItemStack item = cm.newItemStack(); + mat = CMIMaterial.get(id, data); + ItemStack item = mat.newItemStack(); item.setAmount(amount); ItemMeta meta = item.getItemMeta(); if (this.name != null) @@ -83,9 +86,14 @@ public class JobLimitedItems { return null; } + @Deprecated public int getId() { return id; } + + public CMIMaterial getType(){ + return mat; + } public String getName() { return name; diff --git a/src/main/java/com/gamingmesh/jobs/container/NameList.java b/src/main/java/com/gamingmesh/jobs/container/NameList.java index ce369f42..aec9bd03 100644 --- a/src/main/java/com/gamingmesh/jobs/container/NameList.java +++ b/src/main/java/com/gamingmesh/jobs/container/NameList.java @@ -20,31 +20,31 @@ package com.gamingmesh.jobs.container; public class NameList { - private String id; - private String meta; - private String Name; - private String MinecraftName; + private String id; + private String meta; + private String Name; + private String MinecraftName; - public NameList(String id, String meta, String Name, String MinecraftName) { - this.id = id; - this.meta = meta; - this.Name = Name; - this.MinecraftName = MinecraftName; - } + public NameList(String id, String meta, String Name, String MinecraftName) { + this.id = id; + this.meta = meta; + this.Name = Name; + this.MinecraftName = MinecraftName; + } - public String getName() { - return Name; - } + public String getName() { + return Name; + } - public String getId() { - return id; - } + public String getId() { + return id; + } - public String getMeta() { - return meta; - } + public String getMeta() { + return meta; + } - public String getMinecraftName() { - return MinecraftName; - } + public String getMinecraftName() { + return MinecraftName; + } } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 33c58f95..ec908da7 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -691,7 +691,7 @@ public class JobsListener implements Listener { for (Entry oneItem : one.getJob().getLimitedItems().entrySet()) { if (one.getLevel() >= oneItem.getValue().getLevel()) continue; - if (!isThisItem(oneItem.getValue(), iih.getType().getId(), name, lore, enchants)) + if (!isThisItem(oneItem.getValue(), CMIMaterial.get(iih), name, lore, enchants)) continue; meinOk = one.getJob().getName(); break mein; @@ -704,9 +704,9 @@ public class JobsListener implements Listener { } } - private static boolean isThisItem(JobLimitedItems oneItem, int id, String name, List lore, Map enchants) { + private static boolean isThisItem(JobLimitedItems oneItem, CMIMaterial mat, String name, List lore, Map enchants) { - if (oneItem.getId() != id) + if (oneItem.getType() != mat) return false; if (oneItem.getName() != null && name != null) { diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 2bc6538e..55f32065 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -581,9 +581,9 @@ public class JobsPaymentListener implements Listener { // For dye check List DyeStack = new ArrayList<>(); int y = -1; - int first = 0; - int second = 0; - int third = 0; + CMIMaterial first = null; + CMIMaterial second = null; + CMIMaterial third = null; boolean leather = false; for (int i = 0; i < sourceItems.length; i++) { if (sourceItems[i] == null) @@ -592,15 +592,15 @@ public class JobsPaymentListener implements Listener { if (CMIMaterial.isDye(sourceItems[i].getType())) DyeStack.add(sourceItems[i]); - int id = sourceItems[i].getType().getId(); - if (id > 0) { + CMIMaterial mat = CMIMaterial.get(sourceItems[i]); + if (mat != CMIMaterial.NONE) { y++; if (y == 0) - first = id; + first = mat; if (y == 1) - second = id; + second = mat; if (y == 2) - third = id; + third = mat; } switch (CMIMaterial.get(sourceItems[i])) { @@ -624,7 +624,7 @@ public class JobsPaymentListener implements Listener { // Check Dyes if (y >= 2) { - if ((CMIMaterial.get(third).isDye() || CMIMaterial.get(second).isDye()) && leather) { + if ((third != null && third.isDye() || second != null && second.isDye()) && leather) { Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE)); for (ItemStack OneDye : DyeStack) { Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE)); @@ -715,7 +715,9 @@ public class JobsPaymentListener implements Listener { return b == null; else if (b == null) return false; - return a.getType().getId() == b.getType().getId() && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b + CMIMaterial mat1 = CMIMaterial.get(a); + CMIMaterial mat2 = CMIMaterial.get(b); + return mat1 == mat2 && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b .getEnchantments()); } @@ -807,19 +809,19 @@ public class JobsPaymentListener implements Listener { if (Jobs.getGCManager().PayForEnchantingOnAnvil && inv.getItem(1).getType().equals(Material.ENCHANTED_BOOK)) { Map enchants = resultStack.getEnchantments(); for (Entry oneEnchant : enchants.entrySet()) { - Enchantment enchant = oneEnchant.getKey(); - if (enchant == null) - continue; + Enchantment enchant = oneEnchant.getKey(); + if (enchant == null) + continue; - String enchantName = enchant.getName(); - if (enchantName == null) - continue; + String enchantName = enchant.getName(); + if (enchantName == null) + continue; - Integer level = oneEnchant.getValue(); - if (level == null) - continue; + Integer level = oneEnchant.getValue(); + if (level == null) + continue; - Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT)); + Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT)); } } else Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR)); @@ -1625,7 +1627,7 @@ public class JobsPaymentListener implements Listener { return; if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1) - && !Jobs.getGCManager().payExploringWhenGliding && player.isGliding()) + && !Jobs.getGCManager().payExploringWhenGliding && player.isGliding()) return; ExploreRespond respond = Jobs.getExplore().ChunkRespond(player, event.getNewChunk());