1 |
package dk.thoerup.bukkit.hoeruputils; |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
|
3 |
|
|
4 |
|
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 |
|
|
|
import de.codeinfection.quickwango.ApiBukkit.ApiBukkit; |
|
|
import de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiManager; |
|
10 |
import dk.thoerup.bukkit.hoeruputils.creative.GeneralContractorCommands; |
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.StatusListener; |
import dk.thoerup.bukkit.hoeruputils.web.WebLoader; |
13 |
|
|
14 |
public class HoerupUtilsPlugin extends JavaPlugin { |
public class HoerupUtilsPlugin extends JavaPlugin { |
15 |
|
|
48 |
getCommand("fillarea").setExecutor( generalContractor ); |
getCommand("fillarea").setExecutor( generalContractor ); |
49 |
getCommand("slopearea").setExecutor( generalContractor ); |
getCommand("slopearea").setExecutor( generalContractor ); |
50 |
getCommand("setsurface").setExecutor( generalContractor ); |
getCommand("setsurface").setExecutor( generalContractor ); |
51 |
|
getCommand("platform").setExecutor( generalContractor ); |
52 |
|
getCommand("cylinder").setExecutor( generalContractor ); |
53 |
|
getCommand("createcave").setExecutor( generalContractor ); |
54 |
|
|
55 |
|
|
56 |
|
getCommand("template").setExecutor( new TemplateCommand(this) ); |
57 |
|
|
58 |
LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() ); |
LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() ); |
59 |
|
|
75 |
//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); |
76 |
//pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this); |
//pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this); |
77 |
|
|
78 |
ApiBukkit api = (ApiBukkit) pm.getPlugin("ApiBukkit") ; |
try { |
79 |
if ( api != null) { |
try { |
80 |
StatusListener status = new StatusListener(this, getServer(), logintimeHandler.getConfig(), home.getConfig() ); |
//først probes om klassen i det hele taget findes |
81 |
//api.setRequestController("webstatus", status ); |
Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController"); //if it fails it throws an exception |
82 |
//ApiManager.getInstance().registerController( status ); |
WebLoader.getInstance().load(this, logintimeHandler.getConfig(), home.getConfig()); |
83 |
} else { |
|
84 |
System.out.println("Could not find ApiBukkit"); |
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 |
|
|