Solved ParticleEffect help

Discussion in 'Plugin Development' started by MooshViolet, Jul 9, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    MooshViolet

    Code:
    Code:java
    1. package me.MooshViolet.Particles;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.command.Command;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11.  
    12. public class Particles extends JavaPlugin{
    13.  
    14. public void onEnable(){
    15. System.out.println("Particles by MooshViolet is enabled.");
    16. }
    17.  
    18. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    19. if(cmd.getName().equalsIgnoreCase("particle")){
    20.  
    21. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    22. public void run() {
    23. for (Player p : Bukkit.getServer().getOnlinePlayers()) {
    24. if(p.hasPermission("heart.use")){
    25.  
    26. ParticleEffect.HEART.display(p.getLocation().add(0, 2, 0), 15, 0, 0, 0, 10, 10);
    27.  
    28. return;
    29. }else if(p.hasPermission("splash.use")){
    30. ParticleEffect.SPLASH.display(p.getLocation().add(0, 2, 0), 15, 0, 0, 0, 10, 10);
    31. }
    32. }
    33.  
    34. }
    35. }, 0, 20);
    36. }
    37. return true;
    38. }
    39. }


    Ok so when I run this, only 1 player has the heart particle at a time when they run /particle. When the player with the particle dies, then another player has it. I want all players that run /particle to have it at the same time. Help please :)
    Btw I am using the ParticleEffect library. Thanks.
     
  2. Why do you have that return there?
     
  3. Offline

    MooshViolet

  4. MooshViolet The arguments are wrong. Where it says to put a player instance, you put an int. You might want to play with the numbers. The arguments are: Location (location), float (offsetX, I use Random#nextFloat(), but you can also use any number. I recommend 0.1), float (offsetY, the same info as offsetX), float (offsetZ, also the same as offsetX), float (speed, but it will not control the speed of the particle (speed movement), in most of the particles it will do nothing, but it will change the color of the potion particles, for example), int (amount, the amount of particles that will be spawned) and the last one, Player (The player that will see the particles (The player that the packet will be send to), you can loop through all of the players (In the same world) so everyone could see it).

    Welp, that was long. I got all of the information from the class' gist, link: https://gist.github.com/DarkBlade12/5868517 .
     
Thread Status:
Not open for further replies.

Share This Page