Class PlayerToggleInventoryEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.ui.PlayerToggleInventoryEvent
- All Implemented Interfaces:
Cancellable
Called when a player opens or closes the inventory. This is also invoked when the player accesses a storage.
Cancelling the event prevents the player from accessing the inventory. Please note that you can only cancel the open action (i.e if
Cancelling the event prevents the player from accessing the inventory. Please note that you can only cancel the open action (i.e if
isVisible() returns true), you cannot prevent the player from closing the inventory!-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionIf a storage is accessed, this is the particular storage.booleanDetermines if the event is cancelled.booleanIf true, the player tries to open his inventory.voidsetCancelled(boolean cancel) Cancels this event.Methods inherited from class net.risingworld.api.events.player.PlayerEvent
getPlayer
-
Method Details
-
isVisible
public boolean isVisible()If true, the player tries to open his inventory. If false, the player tries to close it.- Returns:
- true if the player wants to open his inventory, false if he wants to close it.
-
getStorage
If a storage is accessed, this is the particular storage. Otherwise, if the player just opens/closes his inventory, null is returned.- Returns:
- the optional storage that is accessed, or null if the player just opens/closes his inventory.
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableDetermines if the event is cancelled. If an event is cancelled, it will no longer be executed, but other plugins will still receive the event.
Please note: If the event is threaded, cancellation has no effect, i.e the event will still be executed.- Specified by:
isCancelledin interfaceCancellable- Returns:
- true if the event is cancelled, or false if not.
-
setCancelled
public void setCancelled(boolean cancel) Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.
Important: You cannot cancel this event if the player is closing the inventory (in other words, you cannot prevent the player from closing the inventory)- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- set to true if you want to cancel this event.
-