Remove outdated method

Former-commit-id: bdab9191cd9b2691159ce6b586b16ffefde9b47b
This commit is contained in:
Ghost_chu committed 2018-08-01 14:37:38 +08:00
1 parent be437a45b9
commit 6393fddaab
7 files changed
+3 -858

No files matched your search

@@ -51,7 +51,6 @@ import org.maxgamer.quickshop.Shop.ContainerShop;
import org.maxgamer.quickshop.Shop.Shop;
import org.maxgamer.quickshop.Shop.ShopManager;
import org.maxgamer.quickshop.Shop.ShopType;
import org.maxgamer.quickshop.Util.CustomItemNameAAA;
//import org.maxgamer.quickshop.Util.CustomPotionsName;
import org.maxgamer.quickshop.Util.MsgUtil;
//import org.maxgamer.quickshop.Util.NMS;
@@ -111,8 +110,7 @@ public class QuickShop extends JavaPlugin {
// private Metrics metrics;
/** Whether debug info should be shown in the console */
public static boolean debug = false;
private Map<Material,List<CustomItemNameAAA>> customItemsName = new HashMap<Material,List<CustomItemNameAAA>>();
private int displayItemCheckTicks;
@@ -521,22 +519,4 @@ public class QuickShop extends JavaPlugin {
public ShopManager getShopManager() {
return this.shopManager;
}
public Map<Material, List<CustomItemNameAAA>> getCustomItemsNameMap() {
return customItemsName;
}
public CustomItemNameAAA getCustomItemNames(ItemStack is) {
List<CustomItemNameAAA> list = customItemsName.get(is.getType());
if (list==null) {
return null;
}
for (CustomItemNameAAA cin : list) {
if (cin.matches(is)) {
return cin;
}
}
return null;
}
}
@@ -1,78 +0,0 @@
package org.maxgamer.quickshop.Util;
import org.bukkit.inventory.ItemStack;
public class CustomItemNameAAA {
private ItemStack itemStack;
private String signName, fullName;
public CustomItemNameAAA(ItemStack itemStack, String signName, String fullName) {
this.itemStack = itemStack;
this.signName = signName;
this.fullName = fullName;
}
public ItemStack getItemStack() {
return itemStack;
}
public String getSignName() {
return signName;
}
public String getFullName() {
return fullName;
}
public boolean matches(ItemStack otherItemStack) {
return otherItemStack.getType()==this.itemStack.getType() && otherItemStack.getDurability()==this.itemStack.getDurability();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
result = prime * result + ((itemStack == null) ? 0 : itemStack.getType().hashCode());
result = prime * result + ((signName == null) ? 0 : signName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CustomItemNameAAA)) {
return false;
}
CustomItemNameAAA other = (CustomItemNameAAA) obj;
if (fullName == null) {
if (other.fullName != null) {
return false;
}
} else if (!fullName.equals(other.fullName)) {
return false;
}
if (itemStack.getItemMeta() == null) {
if (other.itemStack != null) {
return false;
}
} else if (!itemStack.isSimilar(other.itemStack)) {
return false;
}
if (signName == null) {
if (other.signName != null) {
return false;
}
} else if (!signName.equals(other.signName)) {
return false;
}
return true;
}
@Override
public String toString() {
return "CustomItemName [itemStack=" + itemStack + ", signName=" + signName + ", fullName=" + fullName + "]";
}
}
@@ -1,266 +0,0 @@
//package org.maxgamer.quickshop.Util;
//
//import java.util.Collection;
//import java.util.Map;
//
//import org.bukkit.inventory.ItemStack;
//import org.bukkit.potion.PotionEffect;
//import org.bukkit.potion.PotionEffectType;
//import org.bukkit.potion.PotionType;
//
//public class CustomPotionsName {
// private static Map<PotionType,Names> potionTypes;
// private static Map<PotionEffectType,String> potionEffects;
// private static String[] signFormat, shopInfoFormat;
//
// private CustomPotionsName() {}
//
// public static String getSignName(ItemStack potionItemStack) {
// GenericPotionData potion = NMS.getPotionData(potionItemStack);
// if (potion==null) {
// return "InvalidPotion";
// }
//
// if (potion.isCustom() && potionItemStack.hasItemMeta() && potionItemStack.getItemMeta().hasDisplayName()) {
// // return potion name for custom potions
// return potionItemStack.getItemMeta().getDisplayName().replace(" ", "");
// }
//
// Names names = potionTypes.get(potion.getType());
// String type;
// if (names==null) {
// if (potion.getType()==PotionType.WATER) {
// return "WaterBottle";
// }
// type = Util.prettifyText(potion.getType().toString()).replace(" ", "")+"Potion";
// } else {
// type = names.getSign();
// }
//
// type+=(potion.getAmplifier()>1 ? potion.getAmplifier() : "")+(potion.getDuration()==-1 ? "+" : "");
//
// String variety;
// switch(potion.getCategory()) {
// case NORMAL:
// variety = getSignFormat()[1];
// break;
// case SPLASH:
// variety = getSignFormat()[2];
// break;
// case LINGERING:
// variety = getSignFormat()[3];
// break;
// default:
// variety = "Invalid";
// break;
// }
//
// return (getSignFormat()[0].replace("%variety", variety).replace("%type", type)).trim();
// }
//
// public static String getFullName(ItemStack potionItemStack) {
// GenericPotionData potion = NMS.getPotionData(potionItemStack);
// if (potion==null) {
// return "InvalidPotion";
// }
//
// if (potion.isCustom() && potionItemStack.hasItemMeta() && potionItemStack.getItemMeta().hasDisplayName()) {
// // return potion name for custom potions
// return potionItemStack.getItemMeta().getDisplayName().replace(" ", "");
// }
//
// Names names = potionTypes.get(potion.getType());
// String type;
// if (names==null) {
// if (potion.getType()==PotionType.WATER) {
// return "Water Bottle";
// }
// type = Util.prettifyText(potion.getType().toString())+" Potion";
// } else {
// type = names.getFull();
// }
//
// type+=(potion.getAmplifier()>1 ? " "+potion.getAmplifier() : "")+(potion.getDuration()>0 ? " ("+((int)(potion.getDuration()/20))+"s)" : potion.getDuration()==-1 ? "+" : "");
//
// String variety;
// switch(potion.getCategory()) {
// case NORMAL:
// variety = getShopInfoFormat()[1];
// break;
// case SPLASH:
// variety = getShopInfoFormat()[2];
// break;
// case LINGERING:
// variety = getShopInfoFormat()[3];
// break;
// default:
// variety = "Invalid";
// break;
// }
//
// return (getShopInfoFormat()[0].replace("%variety", variety).replace("%type", type)).trim();
// }
//
// public static String getEffects(ItemStack potionItemStack) {
// GenericPotionData potion = NMS.getPotionData(potionItemStack);
// if (potion==null) {
// return "InvalidPotion";
// }
//
// StringBuilder sb = new StringBuilder();
//
// for (PotionEffect potionEffect : potion.getEffects()) {
// PotionEffectType type = potionEffect.getType();
// String name = potionEffects.get(type);
// if (name==null) {
// name = Util.prettifyText(type.getName());
// }
//
// sb.append(name.trim()+(potionEffect.getAmplifier()>1 ? " "+potionEffect.getAmplifier() : "")+(potionEffect.getDuration()>0 ? " ("+((int)(potionEffect.getDuration()/20))+"s)" : potionEffect.getDuration()==-1 ? "+" : "")+" | ");
// }
//
// if (sb.length()>0) {
// sb.setLength(sb.length()-3);
// }
//
// return sb.toString();
// }
//
// public static class Names {
// private String sign, full;
//
// public Names(String sign, String full) {
// this.sign = sign;
// this.full = full;
// }
//
// public String getSign() {
// return sign;
// }
//
// public String getFull() {
// return full;
// }
//
// @Override
// public String toString() {
// return "Names [sign=" + sign + ", full=" + full + "]";
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((full == null) ? 0 : full.hashCode());
// result = prime * result + ((sign == null) ? 0 : sign.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) {
// return true;
// }
// if (obj == null) {
// return false;
// }
// if (!(obj instanceof Names)) {
// return false;
// }
// Names other = (Names) obj;
// if (full == null) {
// if (other.full != null) {
// return false;
// }
// } else if (!full.equals(other.full)) {
// return false;
// }
// if (sign == null) {
// if (other.sign != null) {
// return false;
// }
// } else if (!sign.equals(other.sign)) {
// return false;
// }
// return true;
// }
//
// }
//
// public static class GenericPotionData {
// private PotionType type;
// private Collection<PotionEffect> effects;
// private Category category;
// private boolean custom;
// private int amplifier, duration;
//
// public GenericPotionData(PotionType type, Collection<PotionEffect> effects, Category category, boolean isCustom, int duration, int amplifier) {
// this.type = type;
// this.effects = effects;
// this.category = category;
// this.custom = isCustom;
// this.duration = duration;
// this.amplifier = amplifier;
// }
//
// public PotionType getType() {
// return type;
// }
//
// public Collection<PotionEffect> getEffects() {
// return effects;
// }
//
// public Category getCategory() {
// return category;
// }
//
// public boolean isCustom() {
// return custom;
// }
//
// public int getAmplifier() {
// return amplifier;
// }
//
// public int getDuration() {
// return duration;
// }
//
// public enum Category {
// NORMAL, SPLASH, LINGERING;
// }
// }
//
// public static String[] getSignFormat() {
// return signFormat;
// }
//
// public static String[] getShopInfoFormat() {
// return shopInfoFormat;
// }
//
// public static void setSignFormat(String[] signFormat) {
// CustomPotionsName.signFormat = signFormat;
// }
//
// public static void setShopInfoFormat(String[] shopInfoFormat) {
// CustomPotionsName.shopInfoFormat = shopInfoFormat;
// }
//
// public static Map<PotionType, Names> getPotionTypes() {
// return potionTypes;
// }
//
// public static void setPotionTypes(Map<PotionType, Names> potionTypes) {
// CustomPotionsName.potionTypes = potionTypes;
// }
//
// public static Map<PotionEffectType,String> getPotionEffects() {
// return potionEffects;
// }
//
// public static void setPotionEffects(Map<PotionEffectType,String> potionEffects) {
// CustomPotionsName.potionEffects = potionEffects;
// }
//}
@@ -1,250 +0,0 @@
//package org.maxgamer.quickshop.Util;
//
//import java.util.Collection;
//import java.util.Map;
//
//import org.bukkit.inventory.ItemStack;
//import org.bukkit.inventory.meta.PotionMeta;
//import org.bukkit.potion.Potion;
//import org.bukkit.potion.PotionData;
//import org.bukkit.potion.PotionEffect;
//import org.bukkit.potion.PotionEffectType;
//import org.bukkit.potion.PotionType;
//
//public class CustomPotionsNamesss {
// private static Map<PotionType,Names> potionTypes;
// private static Map<PotionEffectType,String> potionEffects;
// private static String[] signFormat, shopInfoFormat;
//
// private CustomPotionsNamesss() {}
//
// public static String getSignName(ItemStack potionItemStack) {
// org.bukkit.potion.Potion potion = null;
// potion.apply(potionItemStack);
// PotionMeta meta = null;
// if (potion==null) {
// return "InvalidPotion";
// }
//
// if (potionItemStack.hasItemMeta() && potionItemStack.getItemMeta().hasDisplayName()) {
// // return potion name for custom potions
// return potionItemStack.getItemMeta().getDisplayName().replace(" ", "");
// }
//
// Names names = potionTypes.get(potion.getType());
// String type;
// if (names==null) {
// if (potion.getType()==PotionType.WATER) {
// return "WaterBottle";
// }
// type = Util.prettifyText(potion.getType().toString()).replace(" ", "")+"Potion";
// } else {
// type = names.getSign();
// }
// Collection<PotionEffect> effect = potion.getEffects();
// for (PotionEffect potionEffect : effect) {
// type+=(potionEffect.getAmplifier() >1 ? potionEffect.getAmplifier() : "")+(potionEffect.getDuration()==-1 ? "+" : "");
// }
//
// String variety;
// variety = getSignFormat()[1];
// return (getSignFormat()[0].replace("%variety", variety).replace("%type", type)).trim();
// }
//
// public static String getFullName(ItemStack potionItemStack) {
// org.bukkit.potion.Potion potion = null;
// potion.apply(potionItemStack);
// PotionMeta meta = null;
// if (potion==null) {
// return "InvalidPotion";
// }
//
// if (potion.isCustom() && potionItemStack.hasItemMeta() && potionItemStack.getItemMeta().hasDisplayName()) {
// // return potion name for custom potions
// return potionItemStack.getItemMeta().getDisplayName().replace(" ", "");
// }
//
// Names names = potionTypes.get(potion.getType());
// String type;
// if (names==null) {
// if (potion.getType()==PotionType.WATER) {
// return "Water Bottle";
// }
// type = Util.prettifyText(potion.getType().toString())+" Potion";
// } else {
// type = names.getFull();
// }
// Collection<PotionEffect> effect = potion.getEffects();
//
// for (PotionEffect potionEffect : effect) {
// type+=(potionEffect.getAmplifier() >1 ? potionEffect.getAmplifier() : "")+(potionEffect.getDuration()==-1 ? "+" : "");
// }
//
// String variety = getSignFormat()[1];
//
// return (getShopInfoFormat()[0].replace("%variety", variety).replace("%type", type)).trim();
// }
//
// public static String getEffects(ItemStack potionItemStack) {
// GenericPotionData potion = NMS.getPotionData(potionItemStack);
// if (potion==null) {
// return "InvalidPotion";
// }
//
// StringBuilder sb = new StringBuilder();
//
// for (PotionEffect potionEffect : potion.getEffects()) {
// PotionEffectType type = potionEffect.getType();
// String name = potionEffects.get(type);
// if (name==null) {
// name = Util.prettifyText(type.getName());
// }
//
// sb.append(name.trim()+(potionEffect.getAmplifier()>1 ? " "+potionEffect.getAmplifier() : "")+(potionEffect.getDuration()>0 ? " ("+((int)(potionEffect.getDuration()/20))+"s)" : potionEffect.getDuration()==-1 ? "+" : "")+" | ");
// }
//
// if (sb.length()>0) {
// sb.setLength(sb.length()-3);
// }
//
// return sb.toString();
// }
//
// public static class Names {
// private String sign, full;
//
// public Names(String sign, String full) {
// this.sign = sign;
// this.full = full;
// }
//
// public String getSign() {
// return sign;
// }
//
// public String getFull() {
// return full;
// }
//
// @Override
// public String toString() {
// return "Names [sign=" + sign + ", full=" + full + "]";
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((full == null) ? 0 : full.hashCode());
// result = prime * result + ((sign == null) ? 0 : sign.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) {
// return true;
// }
// if (obj == null) {
// return false;
// }
// if (!(obj instanceof Names)) {
// return false;
// }
// Names other = (Names) obj;
// if (full == null) {
// if (other.full != null) {
// return false;
// }
// } else if (!full.equals(other.full)) {
// return false;
// }
// if (sign == null) {
// if (other.sign != null) {
// return false;
// }
// } else if (!sign.equals(other.sign)) {
// return false;
// }
// return true;
// }
//
// }
//
// public static class GenericPotionData {
// private PotionType type;
// private Collection<PotionEffect> effects;
// private Category category;
// private boolean custom;
// private int amplifier, duration;
//
// public GenericPotionData(PotionType type, Collection<PotionEffect> effects, Category category, boolean isCustom, int duration, int amplifier) {
// this.type = type;
// this.effects = effects;
// this.category = category;
// this.custom = isCustom;
// this.duration = duration;
// this.amplifier = amplifier;
// }
//
// public PotionType getType() {
// return type;
// }
//
// public Collection<PotionEffect> getEffects() {
// return effects;
// }
//
// public Category getCategory() {
// return category;
// }
//
// public boolean isCustom() {
// return custom;
// }
//
// public int getAmplifier() {
// return amplifier;
// }
//
// public int getDuration() {
// return duration;
// }
//
// public enum Category {
// NORMAL, SPLASH, LINGERING;
// }
// }
//
// public static String[] getSignFormat() {
// return signFormat;
// }
//
// public static String[] getShopInfoFormat() {
// return shopInfoFormat;
// }
//
// public static void setSignFormat(String[] signFormat) {
// CustomPotionsName.signFormat = signFormat;
// }
//
// public static void setShopInfoFormat(String[] shopInfoFormat) {
// CustomPotionsName.shopInfoFormat = shopInfoFormat;
// }
//
// public static Map<PotionType, Names> getPotionTypes() {
// return potionTypes;
// }
//
// public static void setPotionTypes(Map<PotionType, Names> potionTypes) {
// CustomPotionsName.potionTypes = potionTypes;
// }
//
// public static Map<PotionEffectType,String> getPotionEffects() {
// return potionEffects;
// }
//
// public static void setPotionEffects(Map<PotionEffectType,String> potionEffects) {
// CustomPotionsName.potionEffects = potionEffects;
// }
//}
@@ -56,7 +56,7 @@ public class MsgUtil {
/**
* loads all player purchase messages from the database.
*/
public static void loadTransactionMessages() { //TODO Converted to UUID
public static void loadTransactionMessages() {
player_messages.clear(); // Delete old messages
try {
ResultSet rs = plugin.getDB().getConnection().prepareStatement("SELECT * FROM messages").executeQuery();
@@ -1,235 +0,0 @@
//package org.maxgamer.quickshop.Util;
//
//import java.io.BufferedInputStream;
//import java.io.ByteArrayInputStream;
//import java.io.ByteArrayOutputStream;
//import java.io.DataInput;
//import java.io.DataInputStream;
//import java.io.DataOutput;
//import java.io.DataOutputStream;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.zip.GZIPInputStream;
//import java.util.zip.GZIPOutputStream;
//
//import org.bukkit.Bukkit;
//import org.bukkit.ChatColor;
//import org.bukkit.Material;
//import org.bukkit.entity.Item;
//import org.bukkit.inventory.ItemStack;
//import org.bukkit.inventory.meta.ItemMeta;
//import org.bukkit.inventory.meta.PotionMeta;
//import org.bukkit.potion.PotionEffect;
//import org.bukkit.potion.PotionType;
//import org.maxgamer.quickshop.QuickShop;
//import org.maxgamer.quickshop.Util.CustomPotionsName.GenericPotionData;
//import org.maxgamer.quickshop.Util.CustomPotionsName.GenericPotionData.Category;
//
//import net.minecraft.server.v1_13_R1.IMaterial;
//import net.minecraft.server.v1_13_R1.IMerchant;
//import net.minecraft.server.v1_13_R1.Items;
//
//public class NMS {
// private static ArrayList<NMSDependent> nmsDependencies = new ArrayList<NMSDependent>();
// private static int nextId = 0;
// private static NMSDependent nms;
//
// static {
// nmsDependencies.add(new NMSDependent("v1_13") {
// @Override
// public void safeGuard(Item item) {
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "safeGuard");
// ItemStack iStack = item.getItemStack();
// net.minecraft.server.v1_13_R1.ItemStack nmsItemStack = org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asNMSCopy(iStack);
// nmsItemStack.setCount(0);
// iStack = org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asBukkitCopy(nmsItemStack);
// item.setItemStack(iStack);
// }
//
// @Override
// public byte[] getNBTBytes(org.bukkit.inventory.ItemStack iStack) {
// try{
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "getNBTBytes");
// net.minecraft.server.v1_13_R1.ItemStack is = org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asNMSCopy(iStack);
// net.minecraft.server.v1_13_R1.NBTTagCompound itemCompound = new net.minecraft.server.v1_13_R1.NBTTagCompound();
// itemCompound = is.save(itemCompound);
// ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
// DataOutputStream dataoutputstream = new DataOutputStream(new GZIPOutputStream(bytearrayoutputstream));
// try {
// net.minecraft.server.v1_13_R1.NBTCompressedStreamTools.a(itemCompound, (DataOutput) dataoutputstream);
// } finally {
// dataoutputstream.close();
// }
// return bytearrayoutputstream.toByteArray();
// }catch(Exception e){
// return new byte[0];
// }
// }
//
// @Override
// public org.bukkit.inventory.ItemStack getItemStack(byte[] bytes) {
// ItemStack is = null;
// is.setData(null);
// try{
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "getItemStack");
// DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(bytes))));
// net.minecraft.server.v1_13_R1.NBTTagCompound nbttagcompound;
// try {
// nbttagcompound = net.minecraft.server.v1_13_R1.NBTCompressedStreamTools.a((DataInput) datainputstream, null);
// } finally {
// datainputstream.close();
// }
// IMaterial.
// net.minecraft.server.v1_13_R1.ItemStack is = new net.minecraft.server.v1_13_R1.ItemStack()
// return org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asBukkitCopy(is1);
// }catch(Exception e){
// return new ItemStack(Material.AIR);
// }
// }
//
// @Override
// public GenericPotionData getPotionData(ItemStack potionItemStack) {
// PotionMeta potionMeta = (PotionMeta) potionItemStack.getItemMeta();
//
// Category category;
// switch(potionItemStack.getType()) {
// case POTION:
// category = Category.NORMAL;
// break;
// case SPLASH_POTION:
// category = Category.SPLASH;
// break;
// case LINGERING_POTION:
// category = Category.LINGERING;
// break;
// default:
// return null;
// }
// List<PotionEffect> effects = new ArrayList<PotionEffect>(potionMeta.getCustomEffects().size()+1);
//
// if (potionMeta.hasCustomEffects()) {
// effects.addAll(potionMeta.getCustomEffects());
// }
//
// PotionType potionType = potionMeta.getBasePotionData().getType();
//
// return new GenericPotionData(potionType, effects, category, (potionType==PotionType.WATER || potionType==PotionType.MUNDANE || potionType==PotionType.UNCRAFTABLE || potionType==PotionType.THICK || potionType==PotionType.AWKWARD) && !effects.isEmpty(), potionMeta.getBasePotionData().isExtended() ? -1 : 0, potionMeta.getBasePotionData().isUpgraded() ? 2 : 1);
// }
//
// @Override
// public boolean isPotion(Material material) {
// switch(material) {
// case POTION:
// case SPLASH_POTION:
// case LINGERING_POTION:
// return true;
// default:
// return false;
// }
// }
// });
// }
//
// public static void safeGuard(Item item) throws ClassNotFoundException {
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Renaming");
// rename(item.getItemStack());
// //if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Protecting");
// //protect(item);
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Seting pickup delay");
// item.setPickupDelay(2147483647);
// }
//
// public static void init() {
// String packageName = Bukkit.getServer().getClass().getPackage().getName();
// packageName = packageName.substring(packageName.lastIndexOf(".") + 1);
// //plugin.getLogger().log(Level.WARNING, "Package: " + packageName);
// for (NMSDependent dep : nmsDependencies) {
// if ((packageName.startsWith(dep.getVersion())) || ((dep.getVersion().isEmpty()) && ((packageName.equals("bukkit")) || (packageName.equals("craftbukkit"))))) {
// nms = dep;
// return;
// }
// }
// throw new UnsupportedClassVersionError("This version of QuickShop is incompatible. Internal version: "+packageName);
// }
//
// private static void rename(ItemStack iStack) {
// ItemMeta meta = iStack.getItemMeta();
// meta.setDisplayName(ChatColor.RED + "QuickShop " + Util.getName(iStack) + " " + nextId++);
// iStack.setItemMeta(meta);
// }
//
// public static byte[] getNBTBytes(org.bukkit.inventory.ItemStack iStack) throws ClassNotFoundException {
// return nms.getNBTBytes(iStack);
// }
//
// public static ItemStack getItemStack(byte[] bytes) throws ClassNotFoundException {
// return nms.getItemStack(bytes);
// }
//
// public static boolean isPotion(Material material) {
// return nms.isPotion(material);
// }
//
// public static GenericPotionData getPotionData(ItemStack potion) {
// return nms.getPotionData(potion);
// }
//
// /*private static void protect(Item item) {
// try {
// Field itemField = item.getClass().getDeclaredField("item");
// itemField.setAccessible(true);
// Object nmsEntityItem = itemField.get(item);
// Method getItemStack;
// try {
// getItemStack = nmsEntityItem.getClass().getMethod("getItemStack", new Class[0]);
// } catch (NoSuchMethodException e) {
// try {
// getItemStack = nmsEntityItem.getClass().getMethod("d", new Class[0]);
// } catch (NoSuchMethodException e2) {
// return;
// }
// }
// Object itemStack = getItemStack.invoke(nmsEntityItem, new Object[0]);
// Field countField;
// try {
// countField = itemStack.getClass().getDeclaredField("count");
// } catch (NoSuchFieldException e) {
// countField = itemStack.getClass().getDeclaredField("a");
// }
// countField.setAccessible(true);
// countField.set(itemStack, Integer.valueOf(0));
// } catch (NoSuchFieldException e) {
// e.printStackTrace();
// plugin.getLogger().log(Level.WARNING, "[QuickShop] Could not protect item from pickup properly! Dupes are now possible.");
// } catch (Exception e) {
// plugin.getLogger().log(Level.WARNING, "Other error");
// e.printStackTrace();
// }
// }*/
//
// private static abstract class NMSDependent {
// private String version;
//
// public String getVersion() {
// return this.version;
// }
//
// public NMSDependent(String version) {
// this.version = version;
// }
//
// public abstract boolean isPotion(Material material);
//
// public abstract GenericPotionData getPotionData(ItemStack potionItemStack);
//
// public abstract void safeGuard(Item paramItem);
//
// public byte[] getNBTBytes(org.bukkit.inventory.ItemStack paramItemStack) {
// throw new UnsupportedOperationException();
// }
//
// public org.bukkit.inventory.ItemStack getItemStack(byte[] paramArrayOfByte) {
// throw new UnsupportedOperationException();
// }
// }
//}
@@ -311,13 +311,7 @@ public class Util {
public static String getName(ItemStack itemStack) {
// if (NMS.isPotion(itemStack.getType())) {
// return CustomPotionsName.getFullName(itemStack);
// }
CustomItemNameAAA customItemName = QuickShop.instance.getCustomItemNames(itemStack);
if (customItemName!=null) {
return customItemName.getFullName();
}
// }
String vanillaName = itemStack.getType().name();
return prettifyText(vanillaName);
}