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 class  ItemExpireTimeUpdateEvent.Cause  

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • 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
    void addTime​(TimeUnits unit, int amount)
    Add expire time for item.
    ItemExpireTimeUpdateEvent.Cause getCause()
    Gets the update cause
    long getNewTime()
    Get new expire time
    long getOldTime()
    Get old expire time
    boolean isCancelled()
    Gets the cancellation state of this event.
    void setCancelled​(boolean isCancelled)
    Sets the cancellation state of this event.

    Methods inherited from class dev.tezvn.timeditem.api.event.item.ItemEvent

    getItem, setItem

    Methods inherited from class dev.tezvn.timeditem.api.event.TimedEvent

    getHandlerList, getHandlers

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • 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

      public void addTime​(TimeUnits unit, int amount)
      Add expire time for item.

      Only apply when the new time is greater than the old time.

      Parameters:
      unit - Time units to add
      amount - 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