Class SoulHarvesterListener

java.lang.Object
valorless.rarespawns.soulpower.SoulHarvesterListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class SoulHarvesterListener extends Object implements 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.
This listener runs on the main server thread as required by the Bukkit API.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Registers this listener with the Bukkit plugin manager and schedules a periodic task to evaluate Soul Harvester item conditions for each online player.
    void
    onAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Handles when a player damages another entity.
    void
    onBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
    Handles when a player breaks a block.
    void
    onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
    Handles when a player places a block.
    void
    onCreatureSpawn(org.bukkit.event.entity.CreatureSpawnEvent event)
     
    void
    onDefence(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Handles when a player is damaged by another entity.
    void
    onKill(org.bukkit.event.entity.EntityDeathEvent event)
    Handles when any entity dies.
    void
    onPlayerFish(org.bukkit.event.player.PlayerFishEvent event)
    Handles when a player successfully catches a fish.
    void
    onSpawnerSpawn(org.bukkit.event.entity.SpawnerSpawnEvent event)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 SoulPowerManager.checkConditions(Player, ItemStack, ItemData) for each Soul Harvester item found on the player.

      Work in progress.
    • 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)