Package valorless.rarespawns.soulpower
Class SoulHarvesterListener
java.lang.Object
valorless.rarespawns.soulpower.SoulHarvesterListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for combat-related events to drive Soul Harvester mechanics and
generic Soul Power activations.
Responsibilities:
- Registers itself and a periodic task to evaluate item conditions.
- Handles on-attack and on-defence triggers for Soul Powers.
- Adds souls to eligible Soul Harvester items on entity kill and triggers on-kill powers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Registers this listener with the Bukkit plugin manager and schedules a periodic task to evaluate Soul Harvester item conditions for each online player.voidonAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles when a player damages another entity.voidonBlockBreak(org.bukkit.event.block.BlockBreakEvent event) Handles when a player breaks a block.voidonBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles when a player places a block.voidonCreatureSpawn(org.bukkit.event.entity.CreatureSpawnEvent event) voidonDefence(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles when a player is damaged by another entity.voidonKill(org.bukkit.event.entity.EntityDeathEvent event) Handles when any entity dies.voidonPlayerFish(org.bukkit.event.player.PlayerFishEvent event) Handles when a player successfully catches a fish.voidonSpawnerSpawn(org.bukkit.event.entity.SpawnerSpawnEvent event)
-
Constructor Details
-
SoulHarvesterListener
public SoulHarvesterListener()
-
-
Method Details
-
init
public static void init()Registers this listener with the Bukkit plugin manager and schedules a periodic task to evaluate Soul Harvester item conditions for each online player.The scheduled task runs every 5 seconds (200 ticks) and calls
Work in progress.SoulPowerManager.checkConditions(Player, ItemStack, ItemData)for each Soul Harvester item found on the player. -
onAttack
public void onAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles when a player damages another entity. Evaluates all Soul Powers that trigger on attack for the attacking player, respecting chance, unlock state, and cooldowns.- Parameters:
event- the EntityDamageByEntityEvent fired by Bukkit
-
onDefence
public void onDefence(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles when a player is damaged by another entity. Evaluates all Soul Powers that trigger on defence for the defending player, respecting chance, unlock state, and cooldowns.- Parameters:
event- the EntityDamageByEntityEvent fired by Bukkit
-
onKill
public void onKill(org.bukkit.event.entity.EntityDeathEvent event) Handles when any entity dies. If the killer is a player, adds souls to the player's Soul Harvester items and evaluates on-kill Soul Powers, observing chance and cooldown rules.Non-living entity deaths (e.g., armor stands) are ignored.
- Parameters:
event- the EntityDeathEvent fired by Bukkit
-
onBlockBreak
public void onBlockBreak(org.bukkit.event.block.BlockBreakEvent event) Handles when a player breaks a block. If the block drop includes experience, adds souls to the player's Soul Harvester items that gain souls from mining.- Parameters:
event- the BlockBreakEvent fired by Bukkit
-
onBlockPlace
public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles when a player places a block. Adds souls to the player's Soul Harvester items that gain souls from building.- Parameters:
event- the BlockPlaceEvent fired by Bukkit
-
onPlayerFish
public void onPlayerFish(org.bukkit.event.player.PlayerFishEvent event) Handles when a player successfully catches a fish. Adds souls to the player's Soul Harvester items that gain souls from fishing.- Parameters:
event- the PlayerFishEvent fired by Bukkit
-
onSpawnerSpawn
public void onSpawnerSpawn(org.bukkit.event.entity.SpawnerSpawnEvent event) -
onCreatureSpawn
public void onCreatureSpawn(org.bukkit.event.entity.CreatureSpawnEvent event)
-