vminecraftPlugin.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import java.io.IOException;
  2. import java.util.logging.Level;
  3. import java.util.logging.Logger;
  4. //=====================================================================
  5. //Class: vMinecraftPlugin
  6. //Use: Starts the plugin
  7. //Author: nossr50, TrapAlice, cerevisiae
  8. //=====================================================================
  9. public class vminecraftPlugin extends Plugin {
  10. static final vminecraftListener listener = new vminecraftListener();
  11. protected static final Logger log = Logger.getLogger("Minecraft");
  12. public void enable() {
  13. //Hopefully this will make the plugin load right away
  14. try {
  15. vminecraftSettings.getInstance().loadSettings();
  16. } catch (IOException e) {
  17. log.log(Level.SEVERE, "Exception while loading settings ", e);
  18. }
  19. vminecraftCommands.loadCommands();
  20. }
  21. public void disable() {
  22. //And remove the commands here.
  23. }
  24. public void initialize() {
  25. //Here we add the hook we're going to use. In this case it's the arm swing event.
  26. etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
  27. etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH);
  28. if(etc.getInstance().isHealthEnabled()){
  29. etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM);
  30. }
  31. }
  32. }