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

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

  ViewVC Help
Powered by ViewVC 1.1.20