Class ParticleManager

java.lang.Object
dev.cwhead.GravesX.manager.ParticleManager

public class ParticleManager extends Object
Spawns particles to graves.
  • Field Details

  • Constructor Details

    • ParticleManager

      public ParticleManager(Graves plugin)
  • Method Details

    • startCompassParticleTrail

      public void startCompassParticleTrail(org.bukkit.Location startLocation, org.bukkit.Location endLocation, org.bukkit.Particle particleType, int count, double speed, long durationTicks, UUID playerUUID)
      Plays a particle trail from start to end, stepping one block/tick (or as configured). Each step is executed on the owning region of the current step location so that trails can cross region/chunk boundaries safely.
      Parameters:
      startLocation - start anchor (not mutated)
      endLocation - end anchor (not mutated)
      particleType - particle type to spawn
      count - particle count per step
      speed - step length in blocks per tick (e.g., 0.5 = half a block/tick)
      durationTicks - maximum lifetime of the trail in ticks
      playerUUID - who triggered the trail (used for cooldown)
    • getGravesBlockData

      public BlockData getGravesBlockData(Grave grave, org.bukkit.Location loc)
      Return your Graves BlockData for this grave if available. If the grave has no attached BlockData, synthesize one from config as a fallback so the pipeline is consistent.
    • toBukkitBlockData

      public org.bukkit.block.data.BlockData toBukkitBlockData(BlockData gravesBD)
      Convert your Graves BlockData to Bukkit BlockData for vanilla particle APIs. Uses replaceData if present; otherwise uses replaceMaterial.
    • parseItemStack

      public org.bukkit.inventory.ItemStack parseItemStack(Grave grave)
      Parse an ItemStack from config (material only; amount 1).
      Returns:
      ItemStack or STONE if invalid.
    • safeColor

      public org.bukkit.Color safeColor(String input, org.bukkit.Color def)
      Resolve a Bukkit Color from text, with a default fallback. Accepts names ("RED"), hex ("#FF0000"), or "r,g,b".
    • buildVibrationSingle

      public org.bukkit.Vibration buildVibrationSingle(Graves plugin, org.bukkit.Location graveLoc, Grave grave)
    • spawnVibrationBounce

      public void spawnVibrationBounce(Graves plugin, org.bukkit.Location graveLoc, Grave grave, org.bukkit.Particle particle, int count)
      Build a Vibration instance from config, using block or entity destination. Falls back to a block destination at the origin if parsing fails.
    • parseTrailData

      public Object parseTrailData(Graves plugin, Grave grave)
      Try to construct Particle.Trail reflectively to avoid compile-time dependency. Supports (int duration, double spread), (int), and no-arg constructors.
    • findSourcePlayer

      private static org.bukkit.entity.Player findSourcePlayer(Graves plugin, Grave grave, org.bukkit.Location ref, int radius)
    • pickRandomNearbyPlayer

      private static org.bukkit.entity.Player pickRandomNearbyPlayer(org.bukkit.World world, org.bukkit.Location center, int radius)
    • tryResolveOwnerUUID

      private static UUID tryResolveOwnerUUID(Graves plugin, Grave grave)
    • sameWorld

      private static boolean sameWorld(org.bukkit.entity.Player p, org.bukkit.Location ref)
    • center

      private static org.bukkit.Location center(org.bukkit.Location l)
    • safe

      private static String safe(String s)