/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java revision 1653 by torben, Fri Dec 9 17:06:52 2011 UTC miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java revision 1762 by torben, Wed Mar 21 19:24:25 2012 UTC
# Line 1  Line 1 
1  package dk.thoerup.bukkit.hoeruputils;  package dk.thoerup.bukkit.hoeruputils;
2    
3    
4  import org.bukkit.event.Event;  import java.lang.reflect.Method;
5  import org.bukkit.event.Event.Priority;  
6    import org.bukkit.configuration.Configuration;
7  import org.bukkit.plugin.PluginManager;  import org.bukkit.plugin.PluginManager;
8  import org.bukkit.plugin.java.JavaPlugin;  import org.bukkit.plugin.java.JavaPlugin;
9    
10    import dk.thoerup.bukkit.hoeruputils.creative.GeneralContractorCommands;
11  import dk.thoerup.bukkit.hoeruputils.secretdoor.DoorBlockListener;  import dk.thoerup.bukkit.hoeruputils.secretdoor.DoorBlockListener;
12  import dk.thoerup.bukkit.hoeruputils.web.MessageListener;  import dk.thoerup.bukkit.hoeruputils.web.WebLoader;
 import dk.thoerup.bukkit.hoeruputils.web.StatusListener;  
13    
14  public class HoerupUtilsPlugin extends JavaPlugin {  public class HoerupUtilsPlugin extends JavaPlugin {
15    
# Line 26  public class HoerupUtilsPlugin extends J Line 27  public class HoerupUtilsPlugin extends J
27                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));
28                  getCommand("getpos").setExecutor( new GetposCommand() );                  getCommand("getpos").setExecutor( new GetposCommand() );
29                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );
                 getCommand("spawn").setExecutor( new SpawnCommand() );  
30                  getCommand("tp").setExecutor( new TeleportCommand() );                  getCommand("tp").setExecutor( new TeleportCommand() );
31    
32                  getCommand("wall").setExecutor( new WallCommand() );                  getCommand("wall").setExecutor( new WallCommand() );
33                  getCommand("weather").setExecutor( new WeatherCommand() );                  getCommand("weather").setExecutor( new WeatherCommand() );
34    
35                    getCommand("gc").setExecutor( new GcCommand() );
36    
37    
38                  HomeCommand home = new HomeCommand(this);                  HomeCommand home = new HomeCommand(this);
39                  getCommand("home").setExecutor( home );                  getCommand("home").setExecutor( home );
40                  getCommand("sethome").setExecutor( home );                  getCommand("sethome").setExecutor( home );
                   
                   
                 PluginManager pm = getServer().getPluginManager();  
                 //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);  
                 //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);                
41    
42                    DiverCommand diver = new DiverCommand(this );
43                    getCommand("diver").setExecutor( diver );
44                    
45                    GeneralContractorCommands generalContractor = new GeneralContractorCommands();
46                    getCommand("replay").setExecutor( generalContractor );
47                    getCommand("levelarea").setExecutor( generalContractor );
48                    getCommand("fillarea").setExecutor( generalContractor );
49                    getCommand("slopearea").setExecutor( generalContractor );
50                    getCommand("setsurface").setExecutor( generalContractor );
51                    getCommand("platform").setExecutor( generalContractor );
52                    getCommand("cylinder").setExecutor( generalContractor );
53                    getCommand("createcave").setExecutor( generalContractor );
54    
                 pm.registerEvent(Event.Type.ENDERMAN_PICKUP, new EndermanStopper(), Priority.Normal, this);              
55                                    
56                  //register web plugins                  getCommand("template").setExecutor( new TemplateCommand(this) );
57                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer()), Priority.Normal, this);  
58                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);                  LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() );
59                                    
60                                    
61                    PluginManager pm = getServer().getPluginManager();
62    
63    
64                    pm.registerEvents(logintimeHandler, this);
65                    pm.registerEvents(logintimeHandler, this);
66    
67                    
68                    pm.registerEvents(diver, this);
69    
70    
71                    pm.registerEvents(new EndermanStopper(), this);        
72            
73            
74                    //register web plugins
75                    //pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer(), logintimeHandler.getConfig(), home.getConfig() ), Priority.Normal, this);
76                    //pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);
77    
78                    try {
79                            try {
80                                    //først probes om klassen i det hele taget findes
81                                    Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController"); //if it fails it throws an exception
82                                    WebLoader.getInstance().load(this, logintimeHandler.getConfig(), home.getConfig());
83                            
84                                    getLogger().warning("ApiBukkit found, status listener registered");
85                                    
86                            } catch (ClassNotFoundException e) {
87                                    getLogger().warning("Could not find ApiBukkit - web status is disabled" );
88                            }                      
89                    } catch (Throwable e) { //instead of ClassNotFoundException + NoSuchMethodException + InvocationTargetException + IllegalAccessException
90                            getLogger().warning("Could not find ApiBukkit - web status is disabled (" + e.getClass().getName() + ":" + e.getMessage() + ")"  );
91                    }
92                    
93                    
94    
95                                    
96                  DoorBlockListener secretDoor = new DoorBlockListener(this);                  DoorBlockListener secretDoor = new DoorBlockListener(this);
97                  pm.registerEvent(Event.Type.BLOCK_BREAK, secretDoor, Priority.Normal, this);                  pm.registerEvents(secretDoor, this);
98                  pm.registerEvent(Event.Type.SIGN_CHANGE, secretDoor, Priority.Normal, this);                  pm.registerEvents(secretDoor.getPlayerListener(), this);
                 pm.registerEvent(Event.Type.REDSTONE_CHANGE, secretDoor, Priority.Normal, this);  
                 pm.registerEvent(Event.Type.PLAYER_INTERACT, secretDoor.getPlayerListener(), Priority.Normal, this);  
99                                    
100          }          }
101    
102          private void deprecated() {          private void deprecated() {
103  /*  /*
104                  getCommand("stoner").setExecutor( new StonerCommand() );                  getCommand("stoner").setExecutor( new StonerCommand() );
105                    getCommand("spawn").setExecutor( new SpawnCommand() );
106                  getCommand("boom").setExecutor( new BoomCommand(this) );                  getCommand("boom").setExecutor( new BoomCommand(this) );
107                  getCommand("grass").setExecutor(new GrassCommand());                  getCommand("grass").setExecutor(new GrassCommand());
108    
# Line 87  public class HoerupUtilsPlugin extends J Line 123  public class HoerupUtilsPlugin extends J
123    
124                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);
125    
126                    //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);
127                    //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);              
128    
129  */  */
130          }          }
131    

Legend:
Removed from v.1653  
changed lines
  Added in v.1762

  ViewVC Help
Powered by ViewVC 1.1.20