spenk

RulesConfirm

Feb 12th, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.29 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.IOException;
  3. import java.util.logging.Logger;
  4.  
  5. public class RulesConfirm extends Plugin
  6. {
  7.       String name = "RulesConfirm";
  8.       String version = "1.0";
  9.       String author = " spenk";
  10.       static Logger log = Logger.getLogger("Minecraft");
  11.      
  12.      
  13. public void initialize(){
  14.     RulesConfirmListener listener = new RulesConfirmListener();
  15. log.info(this.name +" version "+ this.version + " by " +this.author+(" is initialized!"));
  16. etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.MEDIUM);
  17. etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
  18. etc.getLoader().addListener(PluginLoader.Hook.PLAYER_MOVE, listener, this, PluginListener.Priority.MEDIUM);
  19. etc.getLoader().addListener(PluginLoader.Hook.BLOCK_BROKEN, listener, this, PluginListener.Priority.MEDIUM);
  20. etc.getLoader().addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this, PluginListener.Priority.MEDIUM);
  21. etc.getLoader().addListener(PluginLoader.Hook.LOGIN, listener, this, PluginListener.Priority.MEDIUM);
  22. etc.getLoader().addListener(PluginLoader.Hook.ITEM_DROP, listener, this, PluginListener.Priority.MEDIUM);
  23. etc.getLoader().addListener(PluginLoader.Hook.ITEM_PICK_UP, listener, this, PluginListener.Priority.MEDIUM);
  24. etc.getLoader().addListener(PluginLoader.Hook.OPEN_INVENTORY, listener, this, PluginListener.Priority.MEDIUM);
  25. etc.getLoader().addListener(PluginLoader.Hook.ITEM_USE, listener, this, PluginListener.Priority.MEDIUM);
  26. File f = new File("plugins/config");
  27. f.mkdir();
  28. listener.loadConfiguration();
  29. try {
  30.      if (!new File(listener.rule).exists()) {
  31.          listener.rules.createNewFile();
  32.      }
  33. } catch (IOException e) {
  34.     log.info("o.O an error occured due creating rules file, please reload the plugin.");
  35. }
  36. try {
  37.      if (!new File(listener.file).exists()) {
  38.          listener.props.createNewFile();
  39.      }
  40. } catch (IOException e) {
  41.     log.info("o.O an error occured due creating rules file, please reload the plugin.");
  42. }
  43. }
  44.  
  45. public void enable(){
  46.     etc.getInstance().addCommand("/rules", "Shows you the rules");
  47.     log.info(this.name + " version " + this.version + " by " + this.author + " is enabled!");
  48. }
  49.  
  50. public void disable(){
  51.    
  52.     log.info(this.name + " version " + this.version + " is disabled!");
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment