Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. package de.craftstuebchen.particles;
  2.  
  3. import org.bukkit.Location;
  4. import org.bukkit.event.Listener;
  5. import org.bukkit.scheduler.BukkitRunnable;
  6.  
  7. public abstract class ParticleEffect implements Listener {
  8.  
  9. private int repeatDelay = 1;
  10. private String name;
  11. private Location location;
  12.  
  13. private Main main;
  14. private BukkitRunnable runnable;
  15.  
  16. public ParticleEffect(Main main) {
  17. this.main = main;
  18. runnable = new BukkitRunnable() {
  19. @Override
  20. public void run() {
  21. onUpdate();
  22. }
  23. };
  24. }
  25.  
  26. public ParticleEffect(int repeatDelay, String name, Location location, Main main) {
  27. this(main);
  28. this.repeatDelay = repeatDelay;
  29. this.name = name;
  30. this.location = location;
  31. }
  32.  
  33. public void start() {
  34. runnable.runTaskTimer(main, 0, repeatDelay);
  35. }
  36.  
  37. public void stop() {
  38. runnable.cancel();
  39. }
  40.  
  41.  
  42. abstract void onUpdate();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement