Package dev.cwhead.GravesX.manager
Class ParticleManager
java.lang.Object
dev.cwhead.GravesX.manager.ParticleManager
Spawns particles to graves.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.VibrationbuildVibrationSingle(Graves plugin, org.bukkit.Location graveLoc, Grave grave) private static org.bukkit.Locationcenter(org.bukkit.Location l) private static org.bukkit.entity.PlayerfindSourcePlayer(Graves plugin, Grave grave, org.bukkit.Location ref, int radius) getGravesBlockData(Grave grave, org.bukkit.Location loc) Return your Graves BlockData for this grave if available.org.bukkit.inventory.ItemStackparseItemStack(Grave grave) Parse an ItemStack from config (material only; amount 1).parseTrailData(Graves plugin, Grave grave) Try to construct Particle.Trail reflectively to avoid compile-time dependency.private static org.bukkit.entity.PlayerpickRandomNearbyPlayer(org.bukkit.World world, org.bukkit.Location center, int radius) private static Stringorg.bukkit.ColorResolve a Bukkit Color from text, with a default fallback.private static booleansameWorld(org.bukkit.entity.Player p, org.bukkit.Location ref) voidspawnVibrationBounce(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.voidstartCompassParticleTrail(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).org.bukkit.block.data.BlockDatatoBukkitBlockData(BlockData gravesBD) Convert your Graves BlockData to Bukkit BlockData for vanilla particle APIs.private static UUIDtryResolveOwnerUUID(Graves plugin, Grave grave)
-
Field Details
-
plugin
-
cooldowns
-
-
Constructor Details
-
ParticleManager
-
-
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 spawncount- particle count per stepspeed- step length in blocks per tick (e.g., 0.5 = half a block/tick)durationTicks- maximum lifetime of the trail in ticksplayerUUID- who triggered the trail (used for cooldown)
-
getGravesBlockData
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
Convert your Graves BlockData to Bukkit BlockData for vanilla particle APIs. Uses replaceData if present; otherwise uses replaceMaterial. -
parseItemStack
Parse an ItemStack from config (material only; amount 1).- Returns:
- ItemStack or STONE if invalid.
-
safeColor
Resolve a Bukkit Color from text, with a default fallback. Accepts names ("RED"), hex ("#FF0000"), or "r,g,b". -
buildVibrationSingle
-
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
Try to construct Particle.Trail reflectively to avoid compile-time dependency. Supports (int duration, double spread), (int), and no-arg constructors. -
findSourcePlayer
-
pickRandomNearbyPlayer
private static org.bukkit.entity.Player pickRandomNearbyPlayer(org.bukkit.World world, org.bukkit.Location center, int radius) -
tryResolveOwnerUUID
-
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
-