Package rs.kreme.ksbot.api.game
Class Consumables
- java.lang.Object
-
- rs.kreme.ksbot.api.game.Consumables
-
public class Consumables extends java.lang.Object
The Consumables class handles interactions with potions and food in the player's inventory. It includes methods for drinking potions, eating food, and managing cooldowns associated with these actions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Consumables.PotionType
-
Constructor Summary
Constructors Constructor Description Consumables()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
drink(Consumables.PotionType type)
Drinks a potion of the specified type if not in cooldown.boolean
eat()
Eats food from inventory, excluding specific items.boolean
eat(java.lang.String name)
Eats a specified food item by name.int
getFoodCount()
Counts the number of edible food items in the inventory, excluding specific items.int
getPrayerCount()
Counts the number of prayer restoration items in the inventory.boolean
hasFood()
Checks if the player has any food items in inventory.boolean
hasPrayer()
Checks if the player has any prayer restoration items in inventory.
-
-
-
Method Detail
-
drink
public boolean drink(Consumables.PotionType type)
Drinks a potion of the specified type if not in cooldown.- Parameters:
type
- the type of potion to drink- Returns:
- true if the potion was successfully drunk, false otherwise
-
eat
public boolean eat()
Eats food from inventory, excluding specific items.- Returns:
- true if food was successfully eaten, false otherwise
-
eat
public boolean eat(java.lang.String name)
Eats a specified food item by name.- Parameters:
name
- the name of the food item to eat- Returns:
- true if the food was successfully eaten, false otherwise
-
hasFood
public boolean hasFood()
Checks if the player has any food items in inventory.- Returns:
- true if food is available, false otherwise
-
hasPrayer
public boolean hasPrayer()
Checks if the player has any prayer restoration items in inventory.- Returns:
- true if prayer items are available, false otherwise
-
getFoodCount
public int getFoodCount()
Counts the number of edible food items in the inventory, excluding specific items.- Returns:
- the count of edible food items
-
getPrayerCount
public int getPrayerCount()
Counts the number of prayer restoration items in the inventory.- Returns:
- the count of prayer items
-
-