Advertisement
Guest User

Plugin Class

a guest
Feb 4th, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.logging.Logger;
  3.  
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.block.Sign;
  6. import org.bukkit.plugin.PluginDescriptionFile;
  7. import org.bukkit.plugin.java.JavaPlugin;
  8.  
  9. public class MyPlugin extends JavaPlugin {
  10. public static final Logger logger = Logger.getLogger("Minecraft");
  11. public ArrayList<Sign> signs = new ArrayList<Sign>();
  12. public int taskId = -1;
  13.  
  14. @Override
  15. public void onDisable() {
  16. PluginDescriptionFile pdfFile = this.getDescription();
  17. /* Cancels all tasks from this plugin */
  18. Bukkit.getScheduler().cancelTasks(this);
  19. logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is now disabled.");
  20. }
  21.  
  22. @Override
  23. public void onEnable() {
  24. PluginDescriptionFile pdfFile = this.getDescription();
  25. /* Schedule your task in your onEnable()
  26. *
  27. * You can set it to an integer if you want to cancel individual tasks with
  28. * Bukkit.getScheduler().cancelTask(taskId);
  29. */
  30. taskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new RepeatingTask(this), 0, 1200);
  31. logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is now enabled.");
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement