Class PlayerQuestsInterface
java.lang.Object
com.ordwen.odailyquests.tools.externals.ExternalItemGetter
com.ordwen.odailyquests.commands.interfaces.playerinterface.items.getters.ItemGetter
com.ordwen.odailyquests.commands.interfaces.playerinterface.items.getters.InterfaceItemGetter
com.ordwen.odailyquests.commands.interfaces.playerinterface.PlayerQuestsInterface
- All Implemented Interfaces:
IInterfaceItem,IItemGetter,IExternalItemGetter
Handles the loading, preparation and dynamic rendering of the player quests interface.
This class is responsible for:
- Parsing the player interface configuration file
- Loading static items (fillers, buttons, command triggers...)
- Assigning quests to inventory slots
- Replacing placeholders dynamically for each player
- Applying custom model data and item model identifiers
- Building the final inventory instance for a specific player
- Executing associated commands when specific items are clicked
The interface supports:
- Custom textures (heads)
- Vanilla materials
- Namespaced items (ItemsAdder/Oraxen/etc.)
- PAPI placeholders in name and lore
- Quest progression placeholders: %progress%, %required%, %progressBar%...
playerQuestsInventoryBase, while dynamic quest items
and PAPI-dependent items are merged into a fresh cloned inventory for each player.-
Constructor Summary
ConstructorsConstructorDescriptionPlayerQuestsInterface(PlayerInterfaceFile playerInterfaceFile) Creates a new player quests interface loader. -
Method Summary
Modifier and TypeMethodDescriptionGet the achieved string defined in the configuration.Get the complete get type string defined in the configuration.getConsoleCommands(int slot) Get all console commands that can be executed by the item in the given slot.getPlayerCommands(int slot) Get all player commands that can be executed by the item in the given slot.org.bukkit.inventory.InventorygetPlayerQuestsInterface(org.bukkit.entity.Player player) Builds and returns the complete, fully-rendered quests inventory for a specific player.Get the status string defined in the configuration.getQuestStatus(Progression progression, org.bukkit.entity.Player player) Determines the correct status message for a quest: Achieved message Progress message Manual completion hint (if enabled)booleanisCloseItem(org.bukkit.inventory.ItemStack itemStack) Check if the item is used to close the inventory.booleanisConsoleCommandItem(int slot) Check if the item is used to execute a command as a console.booleanisFillItem(org.bukkit.inventory.ItemStack itemStack) Check if the item is used to fill the inventory.booleanisPlayerCommandItem(int slot) Check if the item is used to execute a command as a player.voidload()Loads and parses the entire player interface definition.booleanshouldCloseOnClick(int slot) Returns whether the clicked slot should close the inventory after handling the action.Methods inherited from class com.ordwen.odailyquests.commands.interfaces.playerinterface.items.getters.InterfaceItemGetter
configurationError, getCustomHead, getCustomModelDataItem, getItem, getItemModelItem, getItemsAdderItem, getMMOItemsItem, getNexoItem, getOraxenItemMethods inherited from class com.ordwen.odailyquests.commands.interfaces.playerinterface.items.getters.ItemGetter
getCustomModelDataItem, getItemModelItemMethods inherited from class com.ordwen.odailyquests.tools.externals.ExternalItemGetter
getCustomHead, getItemsAdderItem, getMMOItemsItem, getNexoItem, getOraxenItem
-
Constructor Details
-
PlayerQuestsInterface
Creates a new player quests interface loader.- Parameters:
playerInterfaceFile- the configuration file defining layout, items and settings
-
-
Method Details
-
load
public void load()Loads and parses the entire player interface definition.This method:
- Reads global variables
- Loads the mapping between quests and interface slots
- Loads static items (fillers, buttons, command items...)
- Handles item models, flags, names and lore
If misconfigured sections are found, appropriate errors are logged and the interface will be partially or fully disabled.
-
getPlayerQuestsInterface
public org.bukkit.inventory.Inventory getPlayerQuestsInterface(org.bukkit.entity.Player player) Builds and returns the complete, fully-rendered quests inventory for a specific player.The returned inventory:
- Starts from the static base inventory
- Applies dynamic placeholders on PAPI-enabled items
- Injects the player's head (if configured)
- Places quest items depending on progression
If the player has no loaded quests (e.g., reload during session), errors are logged.
- Parameters:
player- the player for whom the inventory is generated- Returns:
- the final rendered inventory, or
nullif generation failed
-
getQuestStatus
Determines the correct status message for a quest:- Achieved message
- Progress message
- Manual completion hint (if enabled)
- Parameters:
progression- quest progressionplayer- the player- Returns:
- the rendered status string
-
isFillItem
public boolean isFillItem(org.bukkit.inventory.ItemStack itemStack) Check if the item is used to fill the inventory.- Parameters:
itemStack- item to check.- Returns:
- true if the item is used to fill the inventory, false otherwise.
-
isCloseItem
public boolean isCloseItem(org.bukkit.inventory.ItemStack itemStack) Check if the item is used to close the inventory.- Parameters:
itemStack- item to check.- Returns:
- true if the item is used to close the inventory, false otherwise.
-
isPlayerCommandItem
public boolean isPlayerCommandItem(int slot) Check if the item is used to execute a command as a player.- Parameters:
slot- slot of the item.- Returns:
- true if the item is used to execute a player command, false otherwise.
-
isConsoleCommandItem
public boolean isConsoleCommandItem(int slot) Check if the item is used to execute a command as a console.- Parameters:
slot- slot of the item.- Returns:
- true if the item is used to execute a console command, false otherwise.
-
getPlayerCommands
Get all player commands that can be executed by the item in the given slot.- Parameters:
slot- slot of the item.- Returns:
- the player commands of the item.
-
getConsoleCommands
Get all console commands that can be executed by the item in the given slot.- Parameters:
slot- slot of the item.- Returns:
- the console commands of the item.
-
getAchievedStr
Get the achieved string defined in the configuration.- Returns:
- the achieved string.
-
getProgressStr
Get the status string defined in the configuration.- Returns:
- the status string.
-
getCompleteGetTypeStr
Get the complete get type string defined in the configuration.- Returns:
- the complete get type string.
-
shouldCloseOnClick
public boolean shouldCloseOnClick(int slot) Returns whether the clicked slot should close the inventory after handling the action.- Parameters:
slot- the raw inventory slot index (0-based)- Returns:
- true if the inventory must be closed
-