How do I cancel out particles?

Discussion in 'Plugin Development' started by SergeantBud, Mar 26, 2015.

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

    SergeantBud

    Code:
    Code:
    package me.SergeantBud;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Particles extends JavaPlugin implements Listener {
        public Permission playerPermission = new Permission("Particles.heart");
      
        public void onEnable() {
            this.getLogger().info("[Particles] Particle Effect Being Enabled...");
           }
      
        public void onDisable() {
            this.getLogger().info("[Particles] Particle Effect Being Disabled...");
        }
    
      
      
      
          public boolean onCommand(final CommandSender sender, Command cmd, String label, String[] args) {
               if (cmd.getName().equalsIgnoreCase("heart") && sender instanceof Player) {
                 if (!sender.hasPermission("Particles.heart")) {
                     sender.sendMessage(ChatColor.RED + "[Particles]" + ChatColor.GRAY + " You Do Not Have Access To Use This Plugin!");
                 }
                 if (sender.hasPermission("Particles.heart")) {
                      Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                        public void run() {
                            ParticleEffect.HEART.display(((Entity) sender).getLocation().add(0, 2, 0), 15, 0, 0, 0, 10, 10);
                            }
                        }
                    , 0, 15);
                         sender.sendMessage(ChatColor.RED + "[Particles]" + ChatColor.GRAY + " Heart Particles Enabled!");
                     }
             }  
          
          
        return true;
                  
           }
    }
    
    plugin.yml:
    Code:
    name: Particles
    main: me.SergeantBud.Particles
    version: 1.0
    commands:
       heart:
          description: Particlesss
          usage: /<command>
    
    
    permissions:
        Particles.heart:
            description: Allow Use Of All Particles
            default: op
    
    Problem: I don't know how to stop the particles .-.
    Anything else: Can anyone link me to a good forum/site where I can learn more about particles and how to create them? :) Thanks
     
  2. Offline

    timtower Administrator Administrator Moderator

    @SergeantBud Loggers in the onEnable and onDisable aren't needed, Bukkit does those for you.
    Particles need to be canceled with packets I believe
     
  3. Offline

    SergeantBud

    Thanks, I'll look into packets!
     
  4. Offline

    RainoBoy97

    Cancel the scheduler :)
     
Thread Status:
Not open for further replies.

Share This Page