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

org.bukkit.event.inventory.InventoryOpenEvent 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.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.InventoryView;

/**
 * Represents a player related inventory event
 */
public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private boolean cancelled;

  public InventoryOpenEvent(InventoryView transaction) {
    super(transaction);
    this.cancelled = false;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Returns the player involved in this event
   *
   * @return Player who is involved in this event
   */
  public final HumanEntity getPlayer() {
    return transaction.getPlayer();
  }

  /**
   * Gets the cancellation state of this event. A cancelled event will not
   * be executed in the server, but will still pass to other plugins.
   * 

* If an inventory open event is cancelled, the inventory screen will not * show. * * @return true if this event is cancelled */ public boolean isCancelled() { return cancelled; } /** * Sets the cancellation state of this event. A cancelled event will not * be executed in the server, but will still pass to other plugins. *

* If an inventory open event is cancelled, the inventory screen will not * show. * * @param cancel true if you wish to cancel this event */ public void setCancelled(boolean cancel) { cancelled = cancel; } @Override public HandlerList getHandlers() { return handlers; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy