Skip to content

Commit

Permalink
Avoid FLAGS errors, fixes #1025
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 2, 2015
1 parent b4e3883 commit 2c5928b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
@@ -1,12 +1,12 @@
package net.aufdemrand.denizen.objects.properties.item;

import net.aufdemrand.denizen.objects.dItem;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.Mechanism;
import net.aufdemrand.denizencore.objects.dList;
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.objects.properties.Property;
import net.aufdemrand.denizencore.tags.Attribute;
import org.bukkit.Material;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
Expand All @@ -15,7 +15,7 @@ public class ItemFlags implements Property {

public static boolean describes(dObject item) {
// All items can have flags
return item instanceof dItem;
return item instanceof dItem && ((dItem) item).getItemStack().getType() != Material.AIR;
}

public static ItemFlags getFrom(dObject _item) {
Expand Down Expand Up @@ -65,7 +65,13 @@ public String getAttribute(Attribute attribute) {

@Override
public String getPropertyString() {
return flags().identify();
dList flags = flags();
if (flags.size() > 0) {
return flags().identify();
}
else {
return null;
}
}

@Override
Expand All @@ -78,7 +84,7 @@ public void adjust(Mechanism mechanism) {

// <--[mechanism]
// @object dItem
// @name flag
// @name flags
// @input dList
// @description
// Sets the item's meta flag set.
Expand Down
Expand Up @@ -142,7 +142,7 @@ public static int lastIndexOfUCL(String str) {
* @return true if c is in between.
*/
public static boolean isBetween(double a, double b, double c) {
return b > a ? (c >= a && c < b): (c >= b && c < a); // Cuboid's have to be compensated for weirdly
return b > a ? (c >= a && c < b): (c >= b && c < a); // Cuboid's have to be compensated for weirdly
}


Expand Down

0 comments on commit 2c5928b

Please sign in to comment.