Advertisement
Guest User

Runnable Class

a guest
Feb 4th, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. import org.bukkit.ChatColor;
  3. import org.bukkit.block.Sign;
  4.  
  5. public class RepeatingTask implements Runnable {
  6. private MyPlugin plugin;
  7.  
  8. public RepeatingTask(MyPlugin plugin) {
  9. this.plugin = plugin;
  10. }
  11.  
  12. @Override
  13. public void run() {
  14. /* Do stuff here like checking statuses 'n stuff
  15. * The SurvivalGames plugin also uses syncronous repeating task for updating stuff
  16. *
  17. * Never use Thread.sleep() or Thread.wait() or people who use y
  18. * our plugin will not like it and complain it lags the server
  19. *
  20. * If this thread stops, the whole server stops, so if you use sleep or wait,
  21. * the whole server will lag.
  22. *
  23. * You MUST use syncronous if you want to use the Bukkit API
  24. *
  25. */
  26. for (Sign s : plugin.signs) {
  27. s.setLine(0, ChatColor.GOLD + "[CastleWars]");
  28. s.setLine(1, "Second line");
  29. s.setLine(2, "Second to last line");
  30. s.setLine(3, "Last line");
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement