/[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 1602 by torben, Mon Sep 26 13:04:40 2011 UTC miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java revision 1760 by torben, Wed Mar 21 17:04:29 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;
 import dk.thoerup.bukkit.hoeruputils.web.MessageListener;  
 import dk.thoerup.bukkit.hoeruputils.web.StatusListener;  
12    
13  public class HoerupUtilsPlugin extends JavaPlugin {  public class HoerupUtilsPlugin extends JavaPlugin {
14    
# Line 24  public class HoerupUtilsPlugin extends J Line 24  public class HoerupUtilsPlugin extends J
24                  getCommand("whereis").setExecutor(new WhereisCommand(getServer()));                  getCommand("whereis").setExecutor(new WhereisCommand(getServer()));
25                  //getCommand("mapgen").setExecutor(new MapgenCommand(this));                  //getCommand("mapgen").setExecutor(new MapgenCommand(this));
26                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));
                 getCommand("grass").setExecutor(new GrassCommand());  
27                  getCommand("getpos").setExecutor( new GetposCommand() );                  getCommand("getpos").setExecutor( new GetposCommand() );
                 getCommand("zapme").setExecutor( new ZapmeCommand() );  
                 getCommand("zap").setExecutor( new ZapCommand() );  
28                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );
                 getCommand("stoner").setExecutor( new StonerCommand() );  
                 getCommand("boom").setExecutor( new BoomCommand(this) );  
                 getCommand("spawn").setExecutor( new SpawnCommand() );  
29                  getCommand("tp").setExecutor( new TeleportCommand() );                  getCommand("tp").setExecutor( new TeleportCommand() );
30    
31                  getCommand("wall").setExecutor( new WallCommand() );                  getCommand("wall").setExecutor( new WallCommand() );
32                  getCommand("weather").setExecutor( new WeatherCommand() );                  getCommand("weather").setExecutor( new WeatherCommand() );
33    
34                    getCommand("gc").setExecutor( new GcCommand() );
35    
36    
37                  HomeCommand home = new HomeCommand(this);                  HomeCommand home = new HomeCommand(this);
38                  getCommand("home").setExecutor( home );                  getCommand("home").setExecutor( home );
39                  getCommand("sethome").setExecutor( home );                  getCommand("sethome").setExecutor( home );
40    
41                    DiverCommand diver = new DiverCommand(this );
42                    getCommand("diver").setExecutor( diver );
43                    
44                    GeneralContractorCommands generalContractor = new GeneralContractorCommands();
45                    getCommand("replay").setExecutor( generalContractor );
46                    getCommand("levelarea").setExecutor( generalContractor );
47                    getCommand("fillarea").setExecutor( generalContractor );
48                    getCommand("slopearea").setExecutor( generalContractor );
49                    getCommand("setsurface").setExecutor( generalContractor );
50                    getCommand("platform").setExecutor( generalContractor );
51                    getCommand("cylinder").setExecutor( generalContractor );
52                    getCommand("createcave").setExecutor( generalContractor );
53    
54                    
55                    getCommand("template").setExecutor( new TemplateCommand(this) );
56    
57                    LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() );
58                                    
59                                    
60                  PluginManager pm = getServer().getPluginManager();                  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);                
61    
62    
63                  pm.registerEvent(Event.Type.ENDERMAN_PICKUP, new EndermanStopper(), Priority.Normal, this);                              pm.registerEvents(logintimeHandler, this);
64                    pm.registerEvents(logintimeHandler, this);
65    
66                                    
67                    pm.registerEvents(diver, this);
68    
69    
70                    pm.registerEvents(new EndermanStopper(), this);        
71            
72            
73                  //register web plugins                  //register web plugins
74                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer()), Priority.Normal, this);                  //pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer(), logintimeHandler.getConfig(), home.getConfig() ), Priority.Normal, this);
75                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);                  //pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);
76    
77                    try {
78                            try {
79                                    //først probes om klassen i det hele taget findes
80                                    Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController");
81                                    
82                                    Class<?>webloader = Class.forName("dk.thoerup.bukkit.hoeruputils.web.WebLoader");                      
83                                    Method load = webloader.getMethod("load", HoerupUtilsPlugin.class, Configuration.class, Configuration.class);
84                                    Object args[] = {this, logintimeHandler.getConfig(), home.getConfig() };
85                                    load.invoke(null, args);
86                                    
87                                    getLogger().warning("ApiBukkit found, status listener registered");
88                                    
89                            } catch (ClassNotFoundException e) {
90                                    getLogger().warning("Could not find ApiBukkit - web status is disabled" );
91                            }
92                            
93                    } catch (Throwable e) { //instead of ClassNotFoundException + NoSuchMethodException + InvocationTargetException + IllegalAccessException
94                            getLogger().warning("Could not find ApiBukkit - web status is disabled (" + e.getClass().getName() + ":" + e.getMessage() + ")"  );
95                    }
96                                    
97                                    
98    
99                    
100                    DoorBlockListener secretDoor = new DoorBlockListener(this);
101                    pm.registerEvents(secretDoor, this);
102                    pm.registerEvents(secretDoor.getPlayerListener(), this);
103                    
104            }
105    
106            private void deprecated() {
107    /*
108                    getCommand("stoner").setExecutor( new StonerCommand() );
109                    getCommand("spawn").setExecutor( new SpawnCommand() );
110                    getCommand("boom").setExecutor( new BoomCommand(this) );
111                    getCommand("grass").setExecutor(new GrassCommand());
112    
113                    getCommand("zapme").setExecutor( new ZapmeCommand() );
114                    getCommand("zap").setExecutor( new ZapCommand() );
115    
116    
117                  PowerMiner powerMiner = new PowerMiner();                  PowerMiner powerMiner = new PowerMiner();
118                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);
119                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);
120                  getCommand("powerminer").setExecutor(powerMiner);                  getCommand("powerminer").setExecutor(powerMiner);
121    
   
122                  SuperMiner superMiner = new SuperMiner();                  SuperMiner superMiner = new SuperMiner();
123                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);
124                  pm.registerEvent(Event.Type.PLAYER_QUIT, superMiner.getPlayerQuitListener(), Priority.Normal, this);                  pm.registerEvent(Event.Type.PLAYER_QUIT, superMiner.getPlayerQuitListener(), Priority.Normal, this);
# Line 69  public class HoerupUtilsPlugin extends J Line 127  public class HoerupUtilsPlugin extends J
127    
128                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);
129    
130                                    //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);
131                  DoorBlockListener secretDoor = new DoorBlockListener(this);                  //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);              
132                  pm.registerEvent(Event.Type.BLOCK_BREAK, secretDoor, Priority.Normal, this);  
133                  pm.registerEvent(Event.Type.SIGN_CHANGE, secretDoor, Priority.Normal, this);  */
                 pm.registerEvent(Event.Type.REDSTONE_CHANGE, secretDoor, Priority.Normal, this);  
                 pm.registerEvent(Event.Type.PLAYER_INTERACT, secretDoor.getPlayerListener(), Priority.Normal, this);  
                   
134          }          }
135    
136  }  }

Legend:
Removed from v.1602  
changed lines
  Added in v.1760

  ViewVC Help
Powered by ViewVC 1.1.20