📜API

Access plugin API

You can only access to API when plugin is fully loaded!

/*
Access into plugin API.
Throw NullPointerException if api is not loaded properly.
*/
TimedItemAPI api = TimedItemAPIProvider.get();
/**
 * @author TezVN
 * @version 1.0
 */
public interface TimedItemAPI {

   /**
    * Get timed item by name
    * @param name Name to get
    * @return Timed item if found, otherwise null
    */
   @Nullable
   ItemStack getTimedItem(String name);

   /**
    * Check if item is TimedItem
    * @param item ItemStack to check
    * @return Is timed item if true, otherwise not
    */
   boolean isTimedItem(ItemStack item);

   /**
    * Get all timed items in player's inventory
    * @param player Player to check
    * @return List that contains timed items
    */
   List<ItemStack> getTimedItems(Player player);

   /**
    * Get timed item in specific location within radius
    * @param location Where to find
    * @param radius The found range
    * @return List that contains timed items
    */
   List<ItemStack> getTimedItems(Location location, double radius);

   /**
    * Set expire time for item
    * @param item ItemStack to set
    * @param format Format will be 'dd/MM/yyyy HH:mm:ss'
    */
   void setTime(ItemStack item, String format);

   /**
    * Add expire time for item with specific format
    * @param item ItemStack to set
    * @param format Time format, example 1h20m
    */
   void addTime(ItemStack item, String format);

   /**
    * Add expire time for item
    * @param item ItemStack to add
    * @param unit Time units
    * @param amount Time amount
    */
   void addTime(ItemStack item, TimeUnits unit, int amount);

   /**
    * Remove expire time from item
    * @param item ItemStack to remove
    * @param format Time format
    */
   void removeTime(ItemStack item, String format);

   /**
    * Remove expire time for item
    * @param item ItemStack to remove
    * @param unit Time units
    * @param amount Time amount
    */
   void removeTime(ItemStack item, TimeUnits unit, int amount);

   /**
    * Clear expire time of item
    * @param item ItemStack to clear
    */
   void clearTime(ItemStack item);

   /**
    * Get item manager object
    * @return Item Manager
    */
   ItemManager getItemManager();
   
}

Last updated