Skip to content

Commit

Permalink
Improve some inventory script matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Aug 10, 2015
1 parent 559ccaa commit d1ec548
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
9 changes: 3 additions & 6 deletions src/main/java/net/aufdemrand/denizen/objects/dInventory.java
Expand Up @@ -505,12 +505,9 @@ else if (getIdType().equals("enderchest")) {
}
}
else if (getIdType().equals("script")) {
// Iterate through inventory scripts
for (InventoryScriptContainer container : InventoryScriptHelper.inventory_scripts.values()) {
if (((CraftInventory) (container.getInventoryFrom()).inventory).getInventory().equals(((CraftInventory) inventory).getInventory())) {
idHolder = container.getName();
return;
}
if (InventoryScriptHelper.tempInventoryScripts.containsKey(inventory)) {
idHolder = InventoryScriptHelper.tempInventoryScripts.get(inventory);
return;
}
}
idType = "generic";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -1859,7 +1859,7 @@ public void adjust(Mechanism mechanism) {
}
}

// <--[tag]
// <--[mechanism]
// @object dPlayer
// @name item_on_cursor
// @input dItem
Expand Down
Expand Up @@ -83,10 +83,6 @@ public InventoryType getInventoryType() {
}
}

public dInventory getInventoryFrom() {
return getInventoryFrom(null, null);
}

public dInventory getInventoryFrom(dPlayer player, dNPC npc) {

dInventory inventory = null;
Expand Down Expand Up @@ -156,11 +152,11 @@ public dInventory getInventoryFrom(dPlayer player, dNPC npc) {
}
}
else if (dItem.matches(item)) {
finalItems[itemsAdded] = dItem.valueOf(TagManager.tag(item, context), player, npc).getItemStack();
finalItems[itemsAdded] = dItem.valueOf(item, player, npc).getItemStack();
}
else {
finalItems[itemsAdded] = new ItemStack(Material.AIR);
if (!item.trim().isEmpty()) {
if (!item.isEmpty()) {
dB.echoError("Inventory script \"" + getName() + "\" has an invalid slot item: ["
+ item + "]... Ignoring it and assuming \"AIR\"");
}
Expand Down

0 comments on commit d1ec548

Please sign in to comment.