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

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    Hi,


    So today I wanted to make a particle plugin, but what got into my mind is that how do I keep the particles from running, I've done everything except for that, I even tried scheduling the events but it just didn't work
    Any help?
     
  2. ConnorFTW

    ConnorFTW Donator

    Messages:
    998
    Likes Received:
    495
    Minecraft:
    ConnorFTW
  3. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    no since this isn't related to the server
     
  4. Ninjaman

    Ninjaman Goodbye letter in info page

    Messages:
    2,628
    Likes Received:
    3,196
    Minecraft:
    Ninjaman
    I think @~Wolf might be able to help :)
     
  5. _MadisonBarks

    _MadisonBarks THAT furry Donator

    Messages:
    1,966
    Likes Received:
    2,746
    What do you mean, keep the particles from running?
     
  6. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    Like when I walk the particle only shows once even with the scheduled events it just gets for 1 time
     
  7. _MadisonBarks

    _MadisonBarks THAT furry Donator

    Messages:
    1,966
    Likes Received:
    2,746
    Try showing the particle inside of a listener for PlayerMoveEvent (or something like that)
     
  8. Leandro

    Leandro Donator

    Messages:
    757
    Likes Received:
    517
    Minecraft:
    ItsLeandro
    You have to create a loop.
     
  9. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    That's what I tried for the first time, but it won't continue

    By exactly what type of loop
     
  10. _MadisonBarks

    _MadisonBarks THAT furry Donator

    Messages:
    1,966
    Likes Received:
    2,746
    Show code?
     
  11. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    this is the lastest thing I tried

    Code:
    package me.SkulledParticles;
    
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerMoveEvent;
    
    public class ParticleCMD implements Listener {
       
       
        private MainParticle plugin;
    
    
        public ParticleCMD(MainParticle plugin){
            this.plugin = plugin;
           
        }
           
    
            public void onMove(PlayerMoveEvent e){
                final Player p = e.getPlayer();
    
                    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    
                        @Override
                        public void run() {
                            ParticleEffect.HEART.display(0, 0, 0, 1, 2, p.getLocation().add(0, 2, 0), 1);
                           
                           
                        }
                       
                    }, 20, 10);
                   
               
               
           
           
            }
           
           
       
    }
    
     
  12. _MadisonBarks

    _MadisonBarks THAT furry Donator

    Messages:
    1,966
    Likes Received:
    2,746
    Well...
    What does your main file look like?
    (upload to hastebin pls)
     
  13. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    ok after rewritng all the shit this is what i got to

    Code:
    package me.SkulledParticles;
    
    
    
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;
    
    public class MainParticle extends JavaPlugin implements Listener{
       
       
        public void onEnable(){
           
        }
           
       
        public void onDisable(){
           
        }
       
        @EventHandler   
        public void onMove(PlayerJoinEvent e){
           
    
                Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new BukkitRunnable() {
    
                    @SuppressWarnings("deprecation")
                    @Override
                    public void run() {
                        for (Player p : Bukkit.getServer().getOnlinePlayers()){
                            ParticleEffect.HEART.display(10, 15, 0, 0, 0, p.getLocation().add(0, 2, 0), 10);
                        }
                           
                       
                       
                    }
                   
                }, 20, 10);
               
           
           
       
       
        }
       
       
       
    }
    
    it used to work but idk now
     
  14. _MadisonBarks

    _MadisonBarks THAT furry Donator

    Messages:
    1,966
    Likes Received:
    2,746
    You need to register the listener no onEnable()
     
  15. Leandro

    Leandro Donator

    Messages:
    757
    Likes Received:
    517
    Minecraft:
    ItsLeandro
    Try what @~Wolf said. If you don't know how: Bukkit.getServer().getPluginManager().registerEvents(this, this);
     
  16. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    lol I know how, thanks for the help, I'll try that
     
  17. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    sorry for double post but I kept working with the code and fixed it
     
  18. Huesan

    Huesan Trust me -- I'm an engineer Donator

    Messages:
    1,213
    Likes Received:
    1,889
    Minecraft:
    Huesan
    In other way, remove the event scheduler and write an infinite loop instead, something like..
    Code:
    package me.SkulledParticles;
    
    import java.util.Arrays;
    
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class MainParticle extends JavaPlugin implements Listener {
       
       
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
        }
        @EventHandler
        public void onplayerjoin(PlayerJoinEvent event){
            Player p = event.getPlayer();
            while (p.isOnline() == true){
                ParticleEffect.HEART.display(10, 15, 0, 0, 0, p.getLocation().add(0, 2, 0), 10);
            }
        }
       
    }
    
    So as long as the player is online, the particles are activated.
     
  19. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    but wait, cant you stop a loop, I already know loops for forgot how to stop dem

    EDIT: sorry, I didnt notice the while xD
     
    Last edited: Jan 29, 2015
  20. TheBlackHamood

    TheBlackHamood Feel Pain, Accept Pain, Know Pain

    Messages:
    3,709
    Likes Received:
    2,032
    Minecraft:
    twista_17 & _Hamood
    Sorry for double post but thanks to @HDestroyer787 for reminding me of while usage and loops, I almost forgot them because it was a long time since I used them

    /c
     
    Huesan likes this.
Thread Status:
Not open for further replies.