Klasse PlayerProcessItemEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.PlayerProcessItemEvent
- Alle implementierten Schnittstellen:
Cancellable
Called when the player "processes" an item in his inventory. For example, this is called
when the player cuts a watermelon, slices bread, fills a canteen or bucket etc. This usually (but not always) results in
the item being removed (e.g the water melon) and one or more new items being added to the inventory (e.g water melon slices).
In other situations (e.g when filling a canteen), the item instance is kept and just the item status/value is changed.
Example: Trigger non-lethal explosion if player cuts a watermelon
-
Feldübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetItem()
Gets the item the player wants to process.int
Gets the new stack size of the item.int
Gets the optional new status for the item.short
Gets the new target item type ID.float
Gets the optional new value for the item.boolean
Determines if the event is cancelled.void
setCancelled
(boolean cancel) Cancels this event.void
setNewStack
(int newStack) Sets a new stack (amount of items).void
setNewStatus
(int newStatus) Sets a new optional status for the item.void
setNewTypeID
(short newTypeID) Sets a new target item type ID (i.e the type ID of the new item).void
setNewValue
(float newValue) Sets a new optional value for the item.Von Klasse geerbte Methoden net.risingworld.api.events.player.PlayerEvent
getPlayer
-
Methodendetails
-
getItem
Gets the item the player wants to process.- Gibt zurück:
- the item that's about to be processed.
-
getNewTypeID
public short getNewTypeID()Gets the new target item type ID. This means this item will transform to this item (e.g ifgetItem()
returns a water melon,getNewTypeID()
would usually return the type ID of a water melon slice etc).- Gibt zurück:
- the new type ID.
-
setNewTypeID
public void setNewTypeID(short newTypeID) Sets a new target item type ID (i.e the type ID of the new item).- Parameter:
newTypeID
- the new type ID. Set to 0 or negative value to prevent the game from adding a new item to inventory.
-
getNewStack
public int getNewStack()Gets the new stack size of the item.- Gibt zurück:
- the new stack size (amount of items).
-
setNewStack
public void setNewStack(int newStack) Sets a new stack (amount of items).- Parameter:
newStack
- the new stack size (amount of items).
-
getNewStatus
public int getNewStatus()Gets the optional new status for the item.- Gibt zurück:
- the new item status.
-
setNewStatus
public void setNewStatus(int newStatus) Sets a new optional status for the item.- Parameter:
newStatus
- the new item status.
-
getNewValue
public float getNewValue()Gets the optional new value for the item.- Gibt zurück:
- the new item value.
-
setNewValue
public void setNewValue(float newValue) Sets a new optional value for the item.- Parameter:
newValue
- the new item value.
-
getItemInfoType
-
isCancelled
public boolean isCancelled()Beschreibung aus Schnittstelle kopiert:Cancellable
Determines 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.- Angegeben von:
isCancelled
in SchnittstelleCancellable
- Gibt zurück:
- true if the event is cancelled, or false if not.
-
setCancelled
public void setCancelled(boolean cancel) Beschreibung aus Schnittstelle kopiert:Cancellable
Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.- Angegeben von:
setCancelled
in SchnittstelleCancellable
- Parameter:
cancel
- set to true if you want to cancel this event.- Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
-