Skip to content

Commit

Permalink
Item name replaces item info if available; remove legacy custom item …
Browse files Browse the repository at this point in the history
…guard
  • Loading branch information
StarTux committed Mar 21, 2017
1 parent 6890728 commit d4958cf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/java/edu/self/startux/craftBay/RealItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ public RealItem(ItemStack stack, int amount) {
this.amount = amount;
if (stack.getType() == Material.AIR) throw new IllegalArgumentException();
ItemMeta meta = stack.getItemMeta();
if (meta.hasLore()) {
List<String> lore = meta.getLore();
if (!lore.isEmpty()) {
if (lore.get(0).contains("" + ChatColor.RESET + ChatColor.BLACK + ChatColor.MAGIC)) {
throw new IllegalArgumentException();
}
}
}
if (stack.getType() == Material.SKULL_ITEM && (int)stack.getDurability() == 3) {
SkullMeta skull = (SkullMeta)meta;
if (!skull.hasOwner() || skull.getOwner() == null) {
Expand Down Expand Up @@ -202,7 +194,6 @@ public String getDescription() {
case 99: sb.append(" (Iron Golem)"); break;
}
}

return sb.toString();
}

Expand All @@ -213,6 +204,10 @@ public ItemAmount getAmount() {

@Override
public String getItemInfo() {
if (CraftBayPlugin.getInstance().getGenericEventsHandler() != null) {
String result = CraftBayPlugin.getInstance().getGenericEventsHandler().getItemName(stack);
if (result != null) return result;
}
StringBuffer result = new StringBuffer();
if (canBeDamaged() && stack.getDurability() > 0) {
int durability = stack.getType().getMaxDurability() - stack.getDurability();
Expand Down

0 comments on commit d4958cf

Please sign in to comment.