Class BasicNeedsHandler
java.lang.Object
me.fami6xx.rpuniverse.core.basicneeds.BasicNeedsHandler
The BasicNeedsHandler is the main class for handling the basic needs.
It is responsible for adding, removing, and updating the basic needs.
The BasicNeedsHandler is a singleton class, so only one instance of it should be created.
The BasicNeedsHandler is also a listener for the PlayerJoinEvent and PlayerQuitEvent. This means that the BasicNeedsHandler will also listen for these events and update the basic needs accordingly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConsumable(org.bukkit.inventory.ItemStack item, ConsumableItem consumable)Add a consumable item to the handler.static StringformatNeedForActionBar(int level, boolean isPoopOrPee)Format the need for the action bar.Gets the basic need config.getConsumable(org.bukkit.inventory.ItemStack item)Get the consumable item for the given item.HashMap<org.bukkit.inventory.ItemStack,ConsumableItem>Get the consumable items.voidinitialize(RPUniverse plugin)Initialize the BasicNeedsHandler.booleanisConsumable(org.bukkit.inventory.ItemStack item)Check if the given item is a consumable.voidremoveConsumable(org.bukkit.inventory.ItemStack item)Remove a consumable item from the handler.voidshutdown()Shutdown the BasicNeedsHandler.
-
Constructor Details
-
BasicNeedsHandler
public BasicNeedsHandler()
-
-
Method Details
-
initialize
Initialize the BasicNeedsHandler. Loads the consumables and starts the tasks.- Parameters:
plugin- The plugin instance
-
shutdown
public void shutdown()Shutdown the BasicNeedsHandler. Stops the tasks and removes the consumables. -
formatNeedForActionBar
Format the need for the action bar.- Parameters:
level- The levelisPoopOrPee-truefor poop or pee,falsefor food or water- Returns:
- The formatted need
-
getConsumables
Get the consumable items.- Returns:
- the consumable items
-
addConsumable
Add a consumable item to the handler.- Parameters:
item- the item to addconsumable- the consumable item
-
getConsumable
Get the consumable item for the given item.- Parameters:
item- the item to get the consumable item for- Returns:
- the consumable item
-
removeConsumable
public void removeConsumable(org.bukkit.inventory.ItemStack item)Remove a consumable item from the handler.- Parameters:
item- the item to remove
-
isConsumable
public boolean isConsumable(org.bukkit.inventory.ItemStack item)Check if the given item is a consumable.- Parameters:
item- the item to check- Returns:
- true if the item is a consumable, false otherwise
-
getConfig
Gets the basic need config.- Returns:
- the basic needs config
-