/[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 1805 by torben, Mon May 28 15:36:28 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.LockedChest;
11    import dk.thoerup.bukkit.hoeruputils.chests.LockedChestBean;
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 24  public class HoerupUtilsPlugin extends J Line 35  public class HoerupUtilsPlugin extends J
35                  getCommand("whereis").setExecutor(new WhereisCommand(getServer()));                  getCommand("whereis").setExecutor(new WhereisCommand(getServer()));
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));
                 getCommand("grass").setExecutor(new GrassCommand());  
38                  getCommand("getpos").setExecutor( new GetposCommand() );                  getCommand("getpos").setExecutor( new GetposCommand() );
39                  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() );  
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                    pm.registerEvents(diver, this);
79    
80                    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                    LockedChest locked = new LockedChest(this, ddlInstaller);
102                    getCommand("lockedchest").setExecutor(locked);
103                    pm.registerEvents( locked, this);
104                    
105                    
106                    getCommand("webuser").setExecutor( new WebUserCommand(this,ddlInstaller) );                            
107    
108            
109                  //register web plugins                  //register web plugins
110                  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);
111                  pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);                  //pm.registerEvent(Event.Type.CUSTOM_EVENT, new MessageListener(getServer()), Priority.Normal, this);
112    
113                    try {
114                            try {
115                                    //først probes om klassen i det hele taget findes
116                                    Class.forName("de.codeinfection.quickwango.ApiBukkit.ApiServer.ApiController"); //if it fails it throws an exception
117                                    WebLoader.getInstance().load(this, logintimeHandler.getConfig(), home.getConfig());
118                            
119                                    getLogger().info("ApiBukkit found, status listener registered");
120                                    
121                            } catch (ClassNotFoundException e) {
122                                    getLogger().warning("Could not find ApiBukkit - web status is disabled" );
123                            }                      
124                    } catch (Throwable e) { //instead of ClassNotFoundException + NoSuchMethodException + InvocationTargetException + IllegalAccessException
125                            getLogger().warning("Could not find ApiBukkit - web status is disabled (" + e.getClass().getName() + ":" + e.getMessage() + ")"  );
126                    }
127                                    
128                                    
129    
130                    
131                    DoorBlockListener secretDoor = new DoorBlockListener(this);
132                    pm.registerEvents(secretDoor, this);
133                    pm.registerEvents(secretDoor.getPlayerListener(), this);
134                    
135            }
136            
137            public MessageWrapper getMessageWrapper() {
138                    return messageWrapper;
139            }
140    
141            //@SuppressWarnings({ "unchecked", "rawtypes" })
142            @Override
143            public List<Class<?>> getDatabaseClasses() {
144                    List<Class<?>> list = new ArrayList<Class<?>>();
145    
146                    list.add(MessageBean.class);
147                    list.add(SnitchingChestBean.class);
148                    list.add(LockedChestBean.class);
149                    list.add(WebUser.class);
150    
151                    return list;
152            }
153    
154            private void deprecated() {
155    /*
156                    getCommand("stoner").setExecutor( new StonerCommand() );
157                    getCommand("spawn").setExecutor( new SpawnCommand() );
158                    getCommand("boom").setExecutor( new BoomCommand(this) );
159                    getCommand("grass").setExecutor(new GrassCommand());
160    
161                    getCommand("zapme").setExecutor( new ZapmeCommand() );
162                    getCommand("zap").setExecutor( new ZapCommand() );
163    
164    
165                  PowerMiner powerMiner = new PowerMiner();                  PowerMiner powerMiner = new PowerMiner();
166                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);
167                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);
168                  getCommand("powerminer").setExecutor(powerMiner);                  getCommand("powerminer").setExecutor(powerMiner);
169    
   
170                  SuperMiner superMiner = new SuperMiner();                  SuperMiner superMiner = new SuperMiner();
171                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);
172                  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 175  public class HoerupUtilsPlugin extends J
175    
176                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);                  //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);
177    
178                                    //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);
179                  DoorBlockListener secretDoor = new DoorBlockListener(this);                  //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);              
180                  pm.registerEvent(Event.Type.BLOCK_BREAK, secretDoor, Priority.Normal, this);  
181                  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);  
                   
182          }          }
183    
184  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.20