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

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

  ViewVC Help
Powered by ViewVC 1.1.20