Skip to content

Commit

Permalink
restore cursor_item context for clicks in inventory event
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 21, 2019
1 parent afa3083 commit 8ea2880
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

public class PlayerClicksInInventoryScriptEvent extends BukkitScriptEvent implements Listener {

Expand Down Expand Up @@ -169,6 +170,9 @@ public ObjectTag getContext(String name) {
else if (name.equals("item")) {
return item;
}
else if (name.equals("cursor_item")) {
return new ItemTag(event.getCursor() == null ? new ItemStack(Material.AIR) : event.getCursor());
}
else if (name.equals("click")) {
return new ElementTag(event.getClick().name());
}
Expand Down

0 comments on commit 8ea2880

Please sign in to comment.