Play Sound Particles - JustKato/BukkitWiki GitHub Wiki

Notes

You can play any of the sounds/particles on a specific player so that you don't bother other players ( maybe you have an item with a cool-down and want to give some visual/sound queues to the player), just replace the World with the Player object
Example:

Player p = Bukkit.getPlayer("JustKato");
p.spawnParticle(Particle.SPELL_WITCH, p.getLocation(), 20, 0.3, 0.2, 0.3, 0.5f);

Sounds

Play sound has 4 parameters baked into it

  • Location - new Location( world, x, y, z)
  • Sound - Sound.X ( ex: Sound.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT )
  • Volume - [0f - ?f] Range is in blocks, so it can go as far as you'd like.
  • Pitch - [0.5f - 2.0f] 1.0f is normal

aWorld.playSound(Locationm, Sound, Volume, Pitch);

Example:

aWorld.playSound(location, Sound.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT, 1F, 0.1F);

Particle

Spawn particle effects
Official Spigot Documentation

  • Particle - Particle.X ( Ex: Particle.SPELL_WITCH )
  • Location - new Location( world, x, y, z )
  • Count - Integer ( How many particles to spawn )
  • X Offset - [0.0f, ?.?f] ( in blocks )
  • Y Offset - [0.0f, ?.?f] ( in blocks )
  • Z Offset - [0.0f, ?.?f] ( in blocks )
  • velocitySpeed - [0.0f, ?.?f] ( in blocks )

aWorld.spawnParticle(Particle, Location, Count, XOffset, YOffset, ZOffset, velocitySpeed);

Example:

aWorld.spawnParticle(Particle.SPELL_WITCH, location, 20, 0.3f, 0.2f, 0.3f, 0.1f);