diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index accf7548..31b3a6d6 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -729,26 +729,6 @@ public class PlayerManager { } } -// public BoostMultiplier getItemBoost(Player player, Job prog) { -// Long time = System.nanoTime(); -// BoostMultiplier data = new BoostMultiplier(); -// if (player == null) -// return data; -// if (prog == null) -// return data; -// ItemStack iih = Jobs.getNms().getItemInMainHand(player); -// data = Jobs.getPlayerManager().getItemBoost(prog, iih); -// for (ItemStack OneArmor : player.getInventory().getArmorContents()) { -// if (OneArmor == null || OneArmor.getType() == Material.AIR) -// continue; -// BoostMultiplier armorboost = Jobs.getPlayerManager().getItemBoost(prog, OneArmor); -// data.add(armorboost); -// } -// Debug.D("Calculated item boost in: " + (System.nanoTime() - time)); -// -// return data; -// } - HashMap> cache = new HashMap>(); public void resetiItemBonusCache(UUID uuid) { @@ -757,7 +737,6 @@ public class PlayerManager { public BoostMultiplier getItemBoostNBT(Player player, Job prog) { - Long time = System.nanoTime(); HashMap cj = cache.get(player.getUniqueId()); if (cj == null) { @@ -770,11 +749,8 @@ public class PlayerManager { c = new ItemBonusCache(player, prog); c.recheck(); cj.put(prog, c); - Debug.D("NBT Calculated item boost in: " + (System.nanoTime() - time)); return c.getBoostMultiplier(); } - - Debug.D("NBT Calculated item boost in: " + (System.nanoTime() - time)); return c.getBoostMultiplier(); } @@ -796,56 +772,6 @@ public class PlayerManager { return data; } -// @SuppressWarnings("deprecation") -// public BoostMultiplier getItemBoost(Job prog, ItemStack item) { -// BoostMultiplier bonus = new BoostMultiplier(); -// if (prog.getItemBonus().isEmpty()) -// return bonus; -// if (item == null) -// return bonus; -// -// ItemMeta meta = item.getItemMeta(); -// String name = null; -// List lore = new ArrayList(); -// -// if (item.hasItemMeta()) { -// if (meta.hasDisplayName()) -// name = meta.getDisplayName(); -// if (meta.hasLore()) -// lore = meta.getLore(); -// } -// -// Map enchants = item.getEnchantments(); -// -// main: for (Entry one : prog.getItemBonus().entrySet()) { -// JobItems oneItem = one.getValue(); -// if (oneItem.getId() != item.getTypeId()) -// continue; -// -// if (oneItem.getName() != null && name != null) -// if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name)) -// continue; -// -// for (String onelore : oneItem.getLore()) { -// if (lore.size() == 0 || !lore.contains(onelore)) -// continue main; -// } -// -// for (Entry oneE : enchants.entrySet()) { -// if (oneItem.getEnchants().containsKey(oneE.getKey())) { -// if (oneItem.getEnchants().get(oneE.getKey()) < oneE.getValue()) { -// continue main; -// } -// } else -// continue main; -// } -// -// return oneItem.getBoost(); -// } -// -// return bonus; -// } - @SuppressWarnings("deprecation") public JobItems getOldItemBoost(Job prog, ItemStack item) { if (prog.getItemBonus().isEmpty()) @@ -929,7 +855,7 @@ public class PlayerManager { boolean gchanged = false; for (int i = 0; i < cont.length; i++) { ItemStack item = cont[i]; - if (item == null || item.getType().equals(Material.AIR) || Jobs.getReflections().hasNbt(iih, "JobsItemBoost")) + if (item == null || item.getType().equals(Material.AIR) || Jobs.getReflections().hasNbt(iih, "JobsItemBoost")) continue; boolean changed = false; for (Job one : Jobs.getJobs()) { diff --git a/src/main/java/com/gamingmesh/jobs/Reflections.java b/src/main/java/com/gamingmesh/jobs/Reflections.java index e8141f54..aabd1aa6 100644 --- a/src/main/java/com/gamingmesh/jobs/Reflections.java +++ b/src/main/java/com/gamingmesh/jobs/Reflections.java @@ -116,26 +116,6 @@ public class Reflections { } } -// public ItemStack removeNbt(ItemStack item, String path) { -// if (item == null) -// return null; -// try { -// Object nmsStack = asNMSCopy(item); -// Method methTag = nmsStack.getClass().getMethod("getTag"); -// Object tag = methTag.invoke(nmsStack); -// if (tag == null) -// tag = NBTTagCompound.newInstance(); -// Method meth = tag.getClass().getMethod("remove", String.class); -// meth.invoke(tag, path); -// Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); -// meth2.invoke(nmsStack, tag); -// return (ItemStack) asBukkitCopy(nmsStack); -// } catch (Exception e) { -// e.printStackTrace(); -// return null; -// } -// } - public ItemStack removeNbt(ItemStack item, String base, String path) { if (item == null) return null; @@ -167,19 +147,6 @@ public class Reflections { } } -// public boolean hasNbt(ItemStack item) { -// if (item == null) -// return false; -// try { -// Object nmsStack = asNMSCopy(item); -// Method methTag = nmsStack.getClass().getMethod("getTag"); -// Object tag = methTag.invoke(nmsStack); -// return tag != null; -// } catch (Exception e) { -// return false; -// } -// } - public boolean hasNbt(ItemStack item, String base) { if (item == null) return false; @@ -208,21 +175,6 @@ public class Reflections { } } -// public Object getNbt(ItemStack item, String path) { -// if (item == null) -// return null; -// try { -// Object nbt = getNbt(item); -// if (nbt == null) -// return null; -// Method meth = nbt.getClass().getMethod("getString", String.class); -// Object res = meth.invoke(nbt, path); -// return res; -// } catch (Exception e) { -// return null; -// } -// } - public Object getNbt(ItemStack item, String base, String path) { if (item == null) return null; @@ -245,26 +197,6 @@ public class Reflections { } } -// public ItemStack setNbt(ItemStack item, String path, String value) { -// if (item == null) -// return null; -// try { -// Object nmsStack = asNMSCopy(item); -// Method methTag = nmsStack.getClass().getMethod("getTag"); -// Object tag = methTag.invoke(nmsStack); -// if (tag == null) -// tag = NBTTagCompound.newInstance(); -// Method meth = tag.getClass().getMethod("setString", String.class, String.class); -// meth.invoke(tag, path, value); -// Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); -// meth2.invoke(nmsStack, tag); -// return (ItemStack) asBukkitCopy(nmsStack); -// } catch (Exception e) { -// e.printStackTrace(); -// return null; -// } -// } - public ItemStack setNbt(ItemStack item, String base, String path, String value) { if (item == null) return null; diff --git a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java index a0ad66cd..0400e313 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java @@ -128,7 +128,7 @@ public class VersionChecker { public String getNewVersion() { try { - HttpURLConnection con = (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php").openConnection(); + HttpURLConnection con = (HttpURLConnection) new URL("https://www.spigotmc.org/api/general.php").openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.getOutputStream().write(("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + resource).getBytes("UTF-8"));