Class PlayerProgressor

java.lang.Object
com.ordwen.odailyquests.quests.player.progression.PlayerProgressor
Direct Known Subclasses:
AbstractQuest, BlockBreakListener, BlockDropItemListener, BlockPlaceListener, BucketFillListener, ClickableChecker, CraftItemListener, CrateOpenListener, CropBreakListener, CustomBlockBreakListener, CustomFurnaceExtractListener, DropQueuePushListener, EliteMobDeathListener, EnchantItemListener, EntityBreedListener, EntityDeathListener, EntityTameListener, FishingLootSpawnListener, FurnaceExtractListener, MythicMobDeathListener, PickupItemListener, PlayerExpChangeListener, PlayerFishListener, PlayerHarvestBlockListener, PlayerInteractListener, PlayerItemConsumeListener, PlayerLevelChangeListener, PlayerRespawnListener, ProjectileHitListener, ProjectileLaunchListener, RoseStackerListener, ShearEntityListener, SmithItemListener, VotifierListener, WildStackerListener

public class PlayerProgressor extends Object
Manages the progression of a player's quests.

This class provides methods to track and update the progression of quests for players, including checking progress, executing actions when a quest is completed, and handling various conditions like world, region, and permissions for progression.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Set<org.bukkit.Material>
     
    protected static final Set<org.bukkit.Material>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    actionQuest(org.bukkit.entity.Player player, Progression progression, AbstractQuest quest, int amount)
    Raises the QuestProgressEvent event and determines whether to perform progress based on the event result.
    int
    fits(org.bukkit.inventory.ItemStack stack, org.bukkit.inventory.ItemStack[] contents)
     
    protected void
    handleDrops(org.bukkit.event.Event event, org.bukkit.entity.Player player, List<org.bukkit.entity.Item> drops)
    Handle the dropped items and update the player progression.
    boolean
    isAllowedToProgress(org.bukkit.entity.Player player, AbstractQuest quest)
    Execute all the checks to determine if the player is allowed to progress in the quest.
    protected boolean
    isPlayerPlacedBlock(org.bukkit.block.Block block, org.bukkit.Material material)
    Check if the block has been placed by the player.
    protected static boolean
    isVerticalPlant(org.bukkit.Material m)
    Check if the given material is a vertical plant.
    boolean
    movingItem(org.bukkit.inventory.ItemStack result, int recipeAmount, org.bukkit.entity.Player player, org.bukkit.event.inventory.ClickType click)
    Checks if the player is moving an item.
    void
    setPlayerQuestProgression(org.bukkit.event.Event event, org.bukkit.entity.Player player, int amount, String questType)
    Set the player's progression for a specific quest type
    protected void
    storeBrokenBlockMetadata(Collection<? extends org.bukkit.inventory.ItemStack> drops, org.bukkit.entity.Player player)
    Adds persistent metadata to each ItemStack in the given collection to indicate that the block was broken by the specified player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VERTICAL_PLANTS_UP

      protected static final Set<org.bukkit.Material> VERTICAL_PLANTS_UP
    • VERTICAL_PLANTS_DOWN

      protected static final Set<org.bukkit.Material> VERTICAL_PLANTS_DOWN
  • Constructor Details

    • PlayerProgressor

      public PlayerProgressor()
  • Method Details

    • isVerticalPlant

      protected static boolean isVerticalPlant(org.bukkit.Material m)
      Check if the given material is a vertical plant.
      Parameters:
      m - the material to check
      Returns:
      true if the material is a vertical plant, false otherwise
    • setPlayerQuestProgression

      public void setPlayerQuestProgression(org.bukkit.event.Event event, org.bukkit.entity.Player player, int amount, String questType)
      Set the player's progression for a specific quest type
      Parameters:
      player - the player to set the progression for
      amount - the amount to set the progression to
      questType - the quest type to set the progression for
    • actionQuest

      public void actionQuest(org.bukkit.entity.Player player, Progression progression, AbstractQuest quest, int amount)
      Raises the QuestProgressEvent event and determines whether to perform progress based on the event result.
      Parameters:
      player - involved player
      progression - player's progression
      quest - quest to be progressed
      amount - amount of progression
    • isAllowedToProgress

      public boolean isAllowedToProgress(org.bukkit.entity.Player player, AbstractQuest quest)
      Execute all the checks to determine if the player is allowed to progress in the quest. This includes checking if the player is in the required world and region.
      Parameters:
      player - the player to check.
      quest - the quest to check.
      Returns:
      true if the player is allowed to progress.
    • fits

      public int fits(org.bukkit.inventory.ItemStack stack, org.bukkit.inventory.ItemStack[] contents)
      Parameters:
      stack - the item to check.
      contents - the inventory contents to compare.
      Returns:
      the amount of items that can be added to the inventory.
    • movingItem

      public boolean movingItem(org.bukkit.inventory.ItemStack result, int recipeAmount, org.bukkit.entity.Player player, org.bukkit.event.inventory.ClickType click)
      Checks if the player is moving an item.
      Parameters:
      result - the result item.
      recipeAmount - the amount of items in the recipe.
      player - the player to check.
      click - the click type.
      Returns:
      true if the player is moving an item.
    • isPlayerPlacedBlock

      protected boolean isPlayerPlacedBlock(org.bukkit.block.Block block, org.bukkit.Material material)
      Check if the block has been placed by the player.
      Parameters:
      block - the block to check
      material - the material of the block
      Returns:
      true if the block has been placed by the player
    • handleDrops

      protected void handleDrops(org.bukkit.event.Event event, org.bukkit.entity.Player player, List<org.bukkit.entity.Item> drops)
      Handle the dropped items and update the player progression.
      Parameters:
      event - the event that triggered the listener
      player - involved player in the event
      drops - list of dropped items
    • storeBrokenBlockMetadata

      protected void storeBrokenBlockMetadata(Collection<? extends org.bukkit.inventory.ItemStack> drops, org.bukkit.entity.Player player)
      Adds persistent metadata to each ItemStack in the given collection to indicate that the block was broken by the specified player.

      This metadata is used by anti-glitch mechanisms to track legitimate block drops and prevent duplication or exploitation.

      Parameters:
      drops - the collection of dropped ItemStacks
      player - the player who broke the original block