Advertisement
Adamki11s

Example.Java

May 9th, 2011
13,720
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.Adamki11s.Example; //Your package
  2.  
  3. import java.util.logging.Logger;
  4. import org.bukkit.Server;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.Event;
  7. import org.bukkit.plugin.Plugin;
  8. import org.bukkit.plugin.PluginManager;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10. //Any other imports can go here
  11.  
  12. /* Example Template
  13.  * By Adamki11s
  14.  * HUGE Plugin Tutorial
  15.  */
  16.  
  17.  
  18. public class Example extends JavaPlugin {
  19.  
  20.     //ClassListeners
  21.         private final ExamplePlayerListener playerListener = new ExamplePlayerListener(this);
  22.     private final ExampleBlockListener blockListener = new ExampleBlockListener(this);
  23.     private final ExampleEntityListener entityListener = new ExampleEntityListener(this);
  24.     //ClassListeners
  25.    
  26.     Logger log = Logger.getLogger("Minecraft");//Define your logger
  27.  
  28.  
  29.     public void onDisable() {
  30.         log.info("Disabled message here, shown in console on startup");
  31.     }
  32.  
  33.     public void onEnable() {
  34.        
  35.         PluginManager pm = this.getServer().getPluginManager();
  36.        
  37.        
  38.         pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
  39.         pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.Normal, this);
  40.     pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.Normal, this);
  41.  
  42. /*Some other example listeners
  43.  
  44.         pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
  45.         pm.registerEvent(Event.Type.CREATURE_SPAWN, spawnListener, Event.Priority.Normal, this);
  46.         pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.Normal, this);
  47.         pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.Normal, this);
  48.         pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.Normal, this);
  49.         pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Normal, this);
  50.         pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.Normal, this);
  51. */
  52.        
  53.        
  54.        
  55.     }
  56.    
  57. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement