Particle to certain player (code got errors)

Discussion in 'Plugin Development' started by 123ang, Jun 8, 2014.

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

    123ang

    Hey there, trying to create a particle plugin that gives a player with the certain name specified in the code a specified particle. All of the particle libraries are done. I just need some help on the main bit of code.

    Code:
    package me.angtim123.particles;
     
    import org.bukkit.Bukkit;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Particles extends JavaPlugin implements Listener {
       
            public void onEnable() {
                    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                            public void run() {
                                    for (player.getName().equalsIgnoreCase("123ang")); {
                                            ParticleEffect.HEART.display(p.getLocation().add(0, 2, 0), 15, 0, 0, 0, 10, 10);
                                    }
                            }
                    }, 0, 20);
            }
    }
    Pic of code (screenshot): [​IMG]

    As I said there's a lot of errors! Please help me to fix this!

    ~123ang
     
  2. Offline

    hanahouhanah

    First: "player" is not defined. It's not anything so far. And you can't assign anything to a player when it's just 'onEnable.' Try using the PlayerJoinEvent (would also fix your random implementation of a Listener). Your loop in your task is also broken. It's looping through nothing to check, what I assume you're trying to do, if the player's name is "123ang." Which is also not how you'd go about it. You also have a semicolon after your for loop. Get rid of that.
    Try
    Code:java
    1. for(Player p : Bukkit.getOnlinePlayers())
    2. {
    3. if(p.getName().equalsIgnoreCase("123ang"))
    4. {
    5. //yourstuff
    6. }
    7. }

    Also, ParticleEffect.HEART.display(p.getLocation().add(0, 2, 0), 15, 0, 0, 0, 10, 10);
    I assume "display" is asking for a location. So why do you have 15, 0, 0, etc... after giving a defined location? Extra parameters or is that just random stuff?
    In short:
    Fix that 'for' and there's something wrong with your ParticleEffect line.
    -
    If there's more, you should point it out. What specific lines and what part.
     
Thread Status:
Not open for further replies.

Share This Page