Class ItemExpireTimeUpdateEvent
java.lang.Object
org.bukkit.event.Event
dev.tezvn.timeditem.api.event.TimedEvent
dev.tezvn.timeditem.api.event.item.ItemEvent
dev.tezvn.timeditem.api.event.item.ItemExpireTimeUpdateEvent
public class ItemExpireTimeUpdateEvent extends ItemEvent
Event will be fired if expire time of item will be modified.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classItemExpireTimeUpdateEvent.Cause -
Constructor Summary
Constructors Constructor Description ItemExpireTimeUpdateEvent(org.bukkit.inventory.ItemStack item, long oldTime, long newTime, ItemExpireTimeUpdateEvent.Cause cause) -
Method Summary
Modifier and Type Method Description voidaddTime(TimeUnits unit, int amount)Add expire time for item.ItemExpireTimeUpdateEvent.CausegetCause()Gets the update causelonggetNewTime()Get new expire timelonggetOldTime()Get old expire timebooleanisCancelled()Gets the cancellation state of this event.voidsetCancelled(boolean isCancelled)Sets the cancellation state of this event.
-
Constructor Details
-
ItemExpireTimeUpdateEvent
public ItemExpireTimeUpdateEvent(org.bukkit.inventory.ItemStack item, long oldTime, long newTime, ItemExpireTimeUpdateEvent.Cause cause)
-
-
Method Details
-
getOldTime
public long getOldTime()Get old expire time- Returns:
- Old expire time of item
-
getNewTime
public long getNewTime()Get new expire time- Returns:
- New expire time of item
-
addTime
Add expire time for item.Only apply when the new time is greater than the old time.
- Parameters:
unit- Time units to addamount- Amount of time
-
isCancelled
public boolean isCancelled()Gets the cancellation state of this event.Set to true if you want to prevent item update expire time.
- Returns:
- True if this event is cancelled
-
setCancelled
public void setCancelled(boolean isCancelled)Sets the cancellation state of this event.Cancelling this event will prevent item update expire time.
- Parameters:
isCancelled- True if you wish to cancel this event
-
getCause
Gets the update cause- Returns:
- The update type
-