/[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 1804 by torben, Mon May 28 15:06:26 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.util.ArrayList;
5  import org.bukkit.event.Event.Priority;  import java.util.List;
6    
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    
11    
12    import dk.thoerup.bukkit.hoeruputils.chests.SnitchingChest;
13    import dk.thoerup.bukkit.hoeruputils.chests.SnitchingChestBean;
14    import dk.thoerup.bukkit.hoeruputils.creative.GeneralContractorCommands;
15    import dk.thoerup.bukkit.hoeruputils.message.MessageBean;
16    import dk.thoerup.bukkit.hoeruputils.message.MessageWrapper;
17  import dk.thoerup.bukkit.hoeruputils.secretdoor.DoorBlockListener;  import dk.thoerup.bukkit.hoeruputils.secretdoor.DoorBlockListener;
18  import dk.thoerup.bukkit.hoeruputils.web.MessageListener;  import dk.thoerup.bukkit.hoeruputils.web.WebLoader;
19  import dk.thoerup.bukkit.hoeruputils.web.StatusListener;  import dk.thoerup.bukkit.hoeruputils.web.WebUser;
20    import dk.thoerup.bukkit.hoeruputils.web.WebUserCommand;
21    
22  public class HoerupUtilsPlugin extends JavaPlugin {  public class HoerupUtilsPlugin extends JavaPlugin {
23    
# Line 16  public class HoerupUtilsPlugin extends J Line 25  public class HoerupUtilsPlugin extends J
25          public void onDisable() {          public void onDisable() {
26                  // TODO Auto-generated method stub                  // TODO Auto-generated method stub
27          }          }
28            
29            MessageWrapper messageWrapper;
30    
31                    
32          @Override          @Override
# Line 25  public class HoerupUtilsPlugin extends J Line 36  public class HoerupUtilsPlugin extends J
36                  //getCommand("mapgen").setExecutor(new MapgenCommand(this));                  //getCommand("mapgen").setExecutor(new MapgenCommand(this));
37                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));                  getCommand("eternalday").setExecutor(new EternalDayCommand(this));
38                  getCommand("getpos").setExecutor( new GetposCommand() );                  getCommand("getpos").setExecutor( new GetposCommand() );
39                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );                  getCommand("msg").setExecutor( new MsgCommand( this ) );
                 getCommand("spawn").setExecutor( new SpawnCommand() );  
40                  getCommand("tp").setExecutor( new TeleportCommand() );                  getCommand("tp").setExecutor( new TeleportCommand() );
41    
42                  getCommand("wall").setExecutor( new WallCommand() );                  getCommand("wall").setExecutor( new WallCommand() );
43                  getCommand("weather").setExecutor( new WeatherCommand() );                  getCommand("weather").setExecutor( new WeatherCommand() );
44    
45                    getCommand("gc").setExecutor( new GcCommand() );
46    
47    
48                  HomeCommand home = new HomeCommand(this);                  HomeCommand home = new HomeCommand(this);
49                  getCommand("home").setExecutor( home );                  getCommand("home").setExecutor( home );
50                  getCommand("sethome").setExecutor( home );                  getCommand("sethome").setExecutor( home );
51    
52                    DiverCommand diver = new DiverCommand(this );
53                    getCommand("diver").setExecutor( diver );
54                    
55                    GeneralContractorCommands generalContractor = new GeneralContractorCommands();
56                    getCommand("replay").setExecutor( generalContractor );
57                    getCommand("levelarea").setExecutor( generalContractor );
58                    getCommand("fillarea").setExecutor( generalContractor );
59                    getCommand("slopearea").setExecutor( generalContractor );
60                    getCommand("setsurface").setExecutor( generalContractor );
61                    getCommand("platform").setExecutor( generalContractor );
62                    getCommand("cylinder").setExecutor( generalContractor );
63                    getCommand("createcave").setExecutor( generalContractor );
64    
65                    
66                    getCommand("template").setExecutor( new TemplateCommand(this) );
67    
68                    LogintimeHandler logintimeHandler = new LogintimeHandler( this.getDataFolder() );
69                                    
70                                    
71                  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);                
72    
73    
74                  pm.registerEvent(Event.Type.ENDERMAN_PICKUP, new EndermanStopper(), Priority.Normal, this);                              pm.registerEvents(logintimeHandler, this);
75                    pm.registerEvents(logintimeHandler, this);
76    
77                                    
78                  //register web plugins                  pm.registerEvents(diver, this);
79                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer()), Priority.Normal, this);  
80                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);                  pm.registerEvents(new EndermanStopper(), this);
81                                    
82                                    
83                    
84                    
85                    
86            
87                    Runnable ddlInstaller = new Runnable() {
88                            @Override
89                            public void run() {
90                                    System.out.println("installddl");
91                                    installDDL();
92                            }
93                    };
94                    messageWrapper = new MessageWrapper(this, ddlInstaller);
95                    pm.registerEvents( messageWrapper, this);
96                    
97                    SnitchingChest snitch = new SnitchingChest(this, ddlInstaller);
98                    getCommand("snitchingchest").setExecutor(snitch);
99                    pm.registerEvents( snitch, this);
100                    
101                    getCommand("webuser").setExecutor( new WebUserCommand(this,ddlInstaller) );                            
102    
103            
104                    //register web plugins
105                    //pm.registerEvent(Event.Type.CUSTOM_EVENT, new StatusListener(getServer(), logintimeHandler.getConfig(), home.getConfig() ), Priority.Normal, this);
106                    //pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);
107    
108                    try {
109                            try {
110                                    //først probes om klassen i det hele taget findes
111                                    Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController"); //if it fails it throws an exception
112                                    WebLoader.getInstance().load(this, logintimeHandler.getConfig(), home.getConfig());
113                            
114                                    getLogger().info("ApiBukkit found, status listener registered");
115                                    
116                            } catch (ClassNotFoundException e) {
117                                    getLogger().warning("Could not find ApiBukkit - web status is disabled" );
118                            }                      
119                    } catch (Throwable e) { //instead of ClassNotFoundException + NoSuchMethodException + InvocationTargetException + IllegalAccessException
120                            getLogger().warning("Could not find ApiBukkit - web status is disabled (" + e.getClass().getName() + ":" + e.getMessage() + ")"  );
121                    }
122                    
123                    
124    
125                                    
126                  DoorBlockListener secretDoor = new DoorBlockListener(this);                  DoorBlockListener secretDoor = new DoorBlockListener(this);
127                  pm.registerEvent(Event.Type.BLOCK_BREAK, secretDoor, Priority.Normal, this);                  pm.registerEvents(secretDoor, this);
128                  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);  
129                                    
130          }          }
131            
132            public MessageWrapper getMessageWrapper() {
133                    return messageWrapper;
134            }
135    
136            //@SuppressWarnings({ "unchecked", "rawtypes" })
137            @Override
138            public List<Class<?>> getDatabaseClasses() {
139                    List<Class<?>> list = new ArrayList<Class<?>>();
140    
141                    list.add(MessageBean.class);
142                    list.add(SnitchingChestBean.class);
143                    list.add(WebUser.class);
144    
145                    return list;
146            }
147    
148          private void deprecated() {          private void deprecated() {
149  /*  /*
150                  getCommand("stoner").setExecutor( new StonerCommand() );                  getCommand("stoner").setExecutor( new StonerCommand() );
151                    getCommand("spawn").setExecutor( new SpawnCommand() );
152                  getCommand("boom").setExecutor( new BoomCommand(this) );                  getCommand("boom").setExecutor( new BoomCommand(this) );
153                  getCommand("grass").setExecutor(new GrassCommand());                  getCommand("grass").setExecutor(new GrassCommand());
154    
# Line 87  public class HoerupUtilsPlugin extends J Line 169  public class HoerupUtilsPlugin extends J
169    
170                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);
171    
172                    //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);
173                    //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);              
174    
175  */  */
176          }          }
177    

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

  ViewVC Help
Powered by ViewVC 1.1.20