org.bukkit.event.inventory.InventoryOpenEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
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