Skip to content

Commit

Permalink
fix unbreakable console error
Browse files Browse the repository at this point in the history
  • Loading branch information
mergu committed Dec 30, 2017
1 parent 32494dc commit d8e3d03
Showing 1 changed file with 5 additions and 3 deletions.
@@ -1,5 +1,7 @@
package net.aufdemrand.denizen.objects.properties.item;

import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.nms.NMSVersion;
import net.aufdemrand.denizen.objects.dItem;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.Mechanism;
Expand Down Expand Up @@ -51,10 +53,10 @@ public String getAttribute(Attribute attribute) {

public String getPropertyString() {
ItemStack itemStack = item.getItemStack();
if (itemStack.hasItemMeta() && itemStack.getItemMeta().spigot().isUnbreakable()) {
return "true";
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
return (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) ? "true" : null;
}
return null;
return (itemStack.hasItemMeta() && itemStack.getItemMeta().spigot().isUnbreakable()) ? "true" : null;
}

public String getPropertyId() {
Expand Down

0 comments on commit d8e3d03

Please sign in to comment.