Skip to content

Commit

Permalink
add context.entity to InvPicksUpItem event
Browse files Browse the repository at this point in the history
  • Loading branch information
mergu committed Dec 30, 2017
1 parent 6ae2214 commit 5851404
Showing 1 changed file with 6 additions and 0 deletions.
@@ -1,6 +1,7 @@
package net.aufdemrand.denizen.events.world;

import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.objects.dInventory;
import net.aufdemrand.denizen.objects.dItem;
import net.aufdemrand.denizen.utilities.DenizenAPI;
Expand Down Expand Up @@ -41,6 +42,7 @@ public InventoryPicksUpItemScriptEvent() {
public static InventoryPicksUpItemScriptEvent instance;
public dInventory inventory;
public dItem item;
public dEntity entity;
public InventoryPickupItemEvent event;

@Override
Expand Down Expand Up @@ -95,13 +97,17 @@ public dObject getContext(String name) {
else if (name.equals("inventory")) {
return inventory;
}
else if (name.equals("entity")) {
return entity;
}
return super.getContext(name);
}

@EventHandler
public void onInvPicksUpItem(InventoryPickupItemEvent event) {
inventory = dInventory.mirrorBukkitInventory(event.getInventory());
item = new dItem(event.getItem());
entity = new dEntity(event.getItem());
cancelled = event.isCancelled();
fire();
event.setCancelled(cancelled);
Expand Down

0 comments on commit 5851404

Please sign in to comment.