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
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 typeprotected void
storeBrokenBlockMetadata
(Collection<? extends org.bukkit.inventory.ItemStack> drops, org.bukkit.entity.Player player) Adds persistent metadata to eachItemStack
in the given collection to indicate that the block was broken by the specified player.
-
Field Details
-
VERTICAL_PLANTS_UP
-
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 foramount
- the amount to set the progression toquestType
- 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 playerprogression
- player's progressionquest
- quest to be progressedamount
- amount of progression
-
isAllowedToProgress
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 checkmaterial
- 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 listenerplayer
- involved player in the eventdrops
- list of dropped items
-
storeBrokenBlockMetadata
protected void storeBrokenBlockMetadata(Collection<? extends org.bukkit.inventory.ItemStack> drops, org.bukkit.entity.Player player) Adds persistent metadata to eachItemStack
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 droppedItemStack
splayer
- the player who broke the original block
-