All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.inventory.InventoryEvent Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.bukkit.event.inventory;

import org.bukkit.entity.HumanEntity;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;

import java.util.List;

/**
 * Represents a player related inventory event
 */
public class InventoryEvent extends Event {
  private static final HandlerList handlers = new HandlerList();
  protected InventoryView transaction;

  public InventoryEvent(InventoryView transaction) {
    this.transaction = transaction;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the primary Inventory involved in this transaction
   *
   * @return The upper inventory.
   */
  public Inventory getInventory() {
    return transaction.getTopInventory();
  }

  /**
   * Gets the list of players viewing the primary (upper) inventory involved
   * in this event
   *
   * @return A list of people viewing.
   */
  public List getViewers() {
    return transaction.getTopInventory().getViewers();
  }

  /**
   * Gets the view object itself
   *
   * @return InventoryView
   */
  public InventoryView getView() {
    return transaction;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy