Code: // Example player.playEffect(player.getLocation, Effect.ENDER_SIGNAL, 2003); This page will probably help you: http://jd.bukkit.org/rb/doxygen/d8/...Effect.html#a1b165e4111aad3e802f843b079dd891a
Just setup a repeating task and do some math. Just get the players eye location. Add 1 to the y so they don't go in front of the player's screen (which is irritating). Then just add values to the x and z to make a circle add all those locations in an ArrayList. Then everytime the repeating task executes, just play the particle effect on the next location.
i get a error when i play effects in the editor: the method playEffect(Location, Effect, int ) from the type player is deprecated code: Code: package me.daansander.particle; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class Particle extends JavaPlugin { public void onEnable() { Bukkit.getLogger().info("Particles has been set"); Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { for (Player p : Bukkit.getServer().getOnlinePlayers()) { p.playEffect(p.getLocation().add(0, 2, 0) , Effect.HEART, 2003); } } }, 0, 5); } }
It will still work. But this will only spawn a particle above your head and not around like you described in the main post. If you want that just ask and i'll explain
Then you should take a look at http://bukkit.org/threads/1-8-particleeffect-v1-7.154406/. Just place that in your repeating task.
1. Create a new class called "ParticleEffect" and put https://github.com/DarkBlade12/Part...arkblade12/particleeffect/ParticleEffect.java in it. 2. Create another class called "ReflectionUtils" and put https://github.com/DarkBlade12/Part...rkblade12/particleeffect/ReflectionUtils.java in it. 3. Replace in your repeating task Code: p.playEffect(p.getLocation().add(0, 2, 0) , Effect.HEART, 2003); with Code: ParticleEffect.NAME.display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range); 4. Compile + test.
WOW thx man maybe can you explain to me how to make them swing around my head so i have a base for another particles?
Create a HashMap<String(playername), Integer(number of location)> for storing the player's animation frame (how i will call it in this example). Then in the repeating task: Code: if(hashmap.get(player.getName()) == null) // Nullchecking because you get a NPE otherwise. hashmap.put(player.getName(), 0); ArrayList<Location> locations = new ArrayList<Location>(); // We store the locations here. int radius = 3; // Your circle radius. // We have to redo this calculation everytime because the player moves and the particles have to move with him. for(int x = player.getLocation().getBlockX() - radius ; x <= player.getLocation().getBlockX() + radius ; x++) for(int z = player.getLocation().getBlockZ() - radius ; x <= player.getLocation().getBlockZ() + radius ; z++) if(Math.round(Math.sqrt(Math.pow(player.getLocation().getBlockX() - x, 2) + Math.pow(player.getLocation().getBlockZ() - z, 2))) == radius) locations.add(new Location(Bukkit.getWorld("world"), x, player.getLocation().getY() + 2, z)); ParticleEffect.NAME.display(float offsetX, float offsetY, float offsetZ, float speed, int amount, locations.get(hashmap.get(player.getName())), double range); // Spawn the particle. hashmap.put(player.getName(), hashmap.get(player.getName() + 1); // Setting the integer to the next frame. if(hashmap.get(player.getName() >= locations.size()) // We have to check that the player's frame int isn't outside the size of locations. We get an OOB otherwise. hashmap.put(player.getName(), 0); player = the player you want the particles to spawn on. radius = the radius of the circle. hashmap = the hashmap you've created earlier in this post. you have to change the ParticleEffect.name.display() to what you want. I hope this helped P.S. Gister was ik op je server en sprak ik HELEMAAL_NIETS.
it is giving errors: The operator >= is undifened for the type(s) string, int The method scheduleSyncRepeatingTask(Plugin, Runnable, long, long) in the type BukkitScheduler is not applicable for the arguments (Particle, new Runnable(){})
It doesn't care if you just use usernames in this example. Only when things are saved between sessions...
They have to relog before their name changes in the server so when you remove them from your ArrayList when they leave, then it'll be fine.