Class AbstractQuest

All Implemented Interfaces:
IQuest
Direct Known Subclasses:
BasicQuest, CarveQuest, CrateOpenQuest, CustomMobQuest, CustomQuest, EntityQuest, ExpLevelQuest, ExpPointsQuest, FireballReflectQuest, ItemQuest, LocationQuest, MilkingQuest, NuVotifierQuest, PlaceholderQuest, PlayerDeathQuest, VotifierPlusQuest

public abstract class AbstractQuest extends PlayerProgressor implements IQuest
Represents an abstract quest that a player can undertake.

This class defines the core properties and methods of a quest, including the quest's name, description, type, reward, required items, and other related attributes. It serves as a base class for specific types of quests.

  • Field Details

    • isRandomRequired

      protected boolean isRandomRequired
    • displayNames

      protected final List<String> displayNames
  • Constructor Details

    • AbstractQuest

      protected AbstractQuest(int questIndex, String questName, String categoryName, List<String> questDesc, String questType, org.bukkit.inventory.ItemStack menuItem, org.bukkit.inventory.ItemStack achievedItem, String requiredAmountRaw, Reward reward, List<String> requiredWorlds, List<String> requiredRegions, boolean protectionBypass, String requiredPermission)
      Constructs a new AbstractQuest with the specified parameters.
      Parameters:
      questIndex - the index of the quest.
      questName - the name of the quest.
      categoryName - the category of the quest.
      questDesc - the description of the quest.
      questType - the type of the quest.
      menuItem - the item used in the quest's menu.
      achievedItem - the item awarded for completing the quest.
      requiredAmountRaw - the required amount of items needed for the quest.
      reward - the reward for completing the quest.
      requiredWorlds - the worlds required for the quest.
      requiredRegions - the regions required for the quest.
      protectionBypass - whether protection bypass is enabled for the quest.
      requiredPermission - the permission required to undertake the quest.
    • AbstractQuest

      protected AbstractQuest(BasicQuest basicQuest)
      Constructs a new AbstractQuest from a BasicQuest.
      Parameters:
      basicQuest - the base quest to initialize this quest.
  • Method Details

    • getSelectedDisplayName

      public String getSelectedDisplayName(int index)
      Gets the selected display name for a random required item.

      This method returns a valid display name from the list of display names based on the provided index. If the index is out of bounds or random required is disabled, it returns an error message.

      Parameters:
      index - the index of the display name.
      Returns:
      the selected display name or an error message.
    • isDisplayNameMissing

      protected boolean isDisplayNameMissing(org.bukkit.configuration.ConfigurationSection section, String file, String index, String path, String type)
      Checks if the display name is missing for a random required item.

      This method validates if the display name for a random required item is missing in the configuration. If missing, it logs an error.

      Parameters:
      section - the configuration section to check.
      file - the file path where the error occurred.
      index - the index of the item.
      path - the path to check for missing values.
      type - the type of display name.
      Returns:
      true if the display name is missing, false otherwise.
    • getQuestIndex

      public int getQuestIndex()
      Get index of quest.
      Returns:
      quest index.
    • getQuestType

      public String getQuestType()
      Get the type of quest.
      Returns:
      the type of the quest.
    • getQuestName

      public String getQuestName()
      Get the name of the quest.
      Returns:
      quest name.
    • getCategoryName

      public String getCategoryName()
      Get the name of the category.
      Returns:
      category name.
    • getMenuItem

      public org.bukkit.inventory.ItemStack getMenuItem()
      Get menu item.
      Returns:
      menu item.
    • getAchievedItem

      public org.bukkit.inventory.ItemStack getAchievedItem()
      Get achieved item.
      Returns:
      achieved item.
    • getQuestDesc

      public List<String> getQuestDesc()
      Get the description of the quest.
      Returns:
      quest description.
    • getRequiredAmountRaw

      public String getRequiredAmountRaw()
      Get the amount required by the quest.
      Returns:
      quest amount-required.
    • getReward

      public Reward getReward()
      Get the reward of the quest.
      Returns:
      quest reward.
    • getRequiredWorlds

      public List<String> getRequiredWorlds()
      Get the required worlds of the quest.
      Returns:
      quest required worlds.
    • getRequiredRegions

      public List<String> getRequiredRegions()
      Get the required regions of the quest.
      Returns:
      quest required regions.
    • isProtectionBypass

      public boolean isProtectionBypass()
      Get whether the quest has protection bypass.
      Returns:
      quest protection bypass.
    • getRequiredPermission

      public String getRequiredPermission()
      Get the required permission of the quest.
      Returns:
      quest required permission.
    • isRandomRequired

      public boolean isRandomRequired()
      Check if the quest is random required.
      Returns:
      true if random required, false otherwise.
    • isRandomRequiredAmount

      public boolean isRandomRequiredAmount()
      Check if the quest requires a random amount of items.
      Returns:
      true if the required amount is a range (e.g., "1-5"), false if it is a fixed number (e.g., "3").