Skip to content

Commit

Permalink
inventory.quantity fix, fix meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 26, 2016
1 parent bb615ac commit 22290ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Expand Up @@ -29,7 +29,7 @@ public class VehicleDamagedScriptEvent extends BukkitScriptEvent implements List
//
// @Cancellable true
//
// @Triggers when an entity enters a vehicle.
// @Triggers when a vehicle is damaged.
//
// @Context
// <context.vehicle> returns the dEntity of the vehicle.
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class VehicleDestroyedScriptEvent extends BukkitScriptEvent implements Li
//
// @Cancellable true
//
// @Triggers when an entity enters a vehicle.
// @Triggers when a vehicle is destroyed.
//
// @Context
// <context.vehicle> returns the dEntity of the vehicle.
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/net/aufdemrand/denizen/objects/dInventory.java
Expand Up @@ -1776,14 +1776,18 @@ else if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName
// one is specified, or the combined quantity of all itemstacks
// if one is not.
// -->
if ((attribute.startsWith("quantity") || attribute.startsWith("qty"))
&& attribute.hasContext(1)
&& dItem.matches(attribute.getContext(1))) {
return new Element(count // TODO: Handle no-script-entry cases
(dItem.valueOf(attribute.getContext(1),
((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer(),
((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getNPC()).getItemStack(), false))
.getAttribute(attribute.fulfill(1));
if (attribute.startsWith("quantity") || attribute.startsWith("qty")) {
if (attribute.hasContext(1) && dItem.matches(attribute.getContext(1))) {
return new Element(count // TODO: Handle no-script-entry cases
(dItem.valueOf(attribute.getContext(1),
((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer(),
((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getNPC()).getItemStack(), false))
.getAttribute(attribute.fulfill(1));
}
else {
return new Element(count(null, false))
.getAttribute(attribute.fulfill(1));
}
}

// <--[tag]
Expand Down

0 comments on commit 22290ff

Please sign in to comment.