1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00
Fix for version check
This commit is contained in:
Zrips 2018-02-13 14:54:12 +02:00
parent 15fd5b97a2
commit 7e33b2d8eb
3 changed files with 2 additions and 144 deletions

View File

@ -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<UUID, HashMap<Job, ItemBonusCache>> cache = new HashMap<UUID, HashMap<Job, ItemBonusCache>>();
public void resetiItemBonusCache(UUID uuid) {
@ -757,7 +737,6 @@ public class PlayerManager {
public BoostMultiplier getItemBoostNBT(Player player, Job prog) {
Long time = System.nanoTime();
HashMap<Job, ItemBonusCache> 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<String> lore = new ArrayList<String>();
//
// if (item.hasItemMeta()) {
// if (meta.hasDisplayName())
// name = meta.getDisplayName();
// if (meta.hasLore())
// lore = meta.getLore();
// }
//
// Map<Enchantment, Integer> enchants = item.getEnchantments();
//
// main: for (Entry<String, JobItems> 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<Enchantment, Integer> 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()) {

View File

@ -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;

View File

@ -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"));