/[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

revision 1685 by torben, Fri Jan 27 14:12:37 2012 UTC 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    
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;  
   
   
 import de.codeinfection.quickwango.ApiBukkit.ApiBukkit;  
12    
13  public class HoerupUtilsPlugin extends JavaPlugin {  public class HoerupUtilsPlugin extends JavaPlugin {
14    
# Line 43  public class HoerupUtilsPlugin extends J Line 40  public class HoerupUtilsPlugin extends J
40    
41                  DiverCommand diver = new DiverCommand(this );                  DiverCommand diver = new DiverCommand(this );
42                  getCommand("diver").setExecutor( diver );                  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() );                  LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() );
58                                    
# Line 65  public class HoerupUtilsPlugin extends J Line 74  public class HoerupUtilsPlugin extends J
74                  //pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer(), logintimeHandler.getConfig(), home.getConfig() ), 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                  ApiBukkit api = (ApiBukkit) pm.getPlugin("ApiBukkit") ;                  try {
78                  if ( api != null) {                          try {
79                          StatusListener status = new StatusListener(this, getServer(), logintimeHandler.getConfig(), home.getConfig() );                                  //først probes om klassen i det hele taget findes
80                          api.setRequestController("webstatus", status );                                  Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController");
81                  } else {                                  
82                          System.out.println("Could not find ApiBukkit");                                  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                                    

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

  ViewVC Help
Powered by ViewVC 1.1.20