vminecraftPlugin.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import java.io.IOException;
  2. import java.util.logging.Level;
  3. import java.util.logging.Logger;
  4. /**
  5. * vminecraft Plugin
  6. * @author Robert, TrapAlice
  7. */
  8. //This is how we setup the listener
  9. public class vminecraftPlugin extends Plugin {
  10. static final vminecraftListener listener = new vminecraftListener();
  11. public void enable() {
  12. //If we had commands we would add them here.
  13. etc.getInstance().addCommand("/masstp", "Teleports those with lower permissions to you");
  14. etc.getInstance().addCommand("/rules", "Displays the rules");
  15. etc.getInstance().addCommand("/fabulous", "makes text SUUUPER");
  16. etc.getInstance().addCommand("/whois", "/whois [user]");
  17. try {
  18. settings.getInstance().loadSettings(); //Hopefully this will make the plugin load right away
  19. } catch (IOException ex) {
  20. Logger.getLogger(vminecraftPlugin.class.getName()).log(Level.SEVERE, null, ex);
  21. }
  22. }
  23. public void disable() {
  24. //And remove the commands here.
  25. }
  26. public void initialize() {
  27. //Here we add the hook we're going to use. In this case it's the arm swing event.
  28. etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
  29. etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH);
  30. if(etc.getInstance().isHealthEnabled()){
  31. etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM);
  32. }
  33. }
  34. }