/[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 1578 by torben, Sat Jul 16 11:01:02 2011 UTC miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/HoerupUtilsPlugin.java revision 1778 by torben, Thu Apr 5 14:10: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.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
27          public void onEnable() {          public void onEnable() {
28                  System.out.println("Loading HoerupUtils plugin");                  System.out.println("Loading HoerupUtils plugin");
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 ) );
34                  getCommand("zap").setExecutor( new ZapCommand() );                  getCommand("tp").setExecutor( new TeleportCommand() );
35                  getCommand("msg").setExecutor( new MsgCommand( getServer() ) );  
36                  getCommand("stoner").setExecutor( new StonerCommand() );                  getCommand("wall").setExecutor( new WallCommand() );
37                  getCommand("boom").setExecutor( new BoomCommand(this) );                  getCommand("weather").setExecutor( new WeatherCommand() );
38                  getCommand("spawn").setExecutor( new SpawnCommand() );  
39                    getCommand("gc").setExecutor( new GcCommand() );
40    
41    
42                    HomeCommand home = new HomeCommand(this);
43                    getCommand("home").setExecutor( home );
44                    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();
66                  pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);  
67                  pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);          
68                    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                    List<Class<?>> list = new ArrayList<Class<?>>();
132    
133                    list.add(MessageBean.class);
134                    list.add(SnitchingChestBean.class);
135    
136                    return list;
137            }
138    
139            private void deprecated() {
140    /*
141                    getCommand("stoner").setExecutor( new StonerCommand() );
142                    getCommand("spawn").setExecutor( new SpawnCommand() );
143                    getCommand("boom").setExecutor( new BoomCommand(this) );
144                    getCommand("grass").setExecutor(new GrassCommand());
145    
146                    getCommand("zapme").setExecutor( new ZapmeCommand() );
147                    getCommand("zap").setExecutor( new ZapCommand() );
148    
149    
150                  PowerMiner powerMiner = new PowerMiner();                  PowerMiner powerMiner = new PowerMiner();
151                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, powerMiner, Priority.Normal, this);
152                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);                  pm.registerEvent(Event.Type.PLAYER_QUIT, powerMiner.getPlayerQuitListener(), Priority.Normal, this);
153                  getCommand("powerminer").setExecutor(powerMiner);                  getCommand("powerminer").setExecutor(powerMiner);
154    
   
155                  SuperMiner superMiner = new SuperMiner();                  SuperMiner superMiner = new SuperMiner();
156                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);                  pm.registerEvent(Event.Type.BLOCK_DAMAGE, superMiner, Priority.Normal, this);
157                  pm.registerEvent(Event.Type.PLAYER_QUIT, superMiner.getPlayerQuitListener(), Priority.Normal, this);                  pm.registerEvent(Event.Type.PLAYER_QUIT, superMiner.getPlayerQuitListener(), Priority.Normal, this);
158                  getCommand("superminer").setExecutor(superMiner);                  getCommand("superminer").setExecutor(superMiner);
159    
                 pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);  
160    
161                                    //pm.registerEvent(Event.Type.PROJECTILE_HIT, new ExplosiveSnowballs(), Priority.Normal, this);
162                  DoorBlockListener secretDoor = new DoorBlockListener(this);  
163                  pm.registerEvent(Event.Type.BLOCK_BREAK, secretDoor, Priority.Normal, this);                  //pm.registerEvent(Event.Type.PLAYER_RESPAWN, new RespawnHandler(this), Priority.Normal, this);
164                  pm.registerEvent(Event.Type.SIGN_CHANGE, secretDoor, Priority.Normal, this);                  //pm.registerEvent(Event.Type.ENTITY_DEATH, new RespawnHandler.PlayerDeathListener(this.getDataFolder()), Priority.Normal, this);              
165                  pm.registerEvent(Event.Type.REDSTONE_CHANGE, secretDoor, Priority.Normal, this);  
166                  pm.registerEvent(Event.Type.PLAYER_INTERACT, secretDoor.getPlayerListener(), Priority.Normal, this);  */
                   
167          }          }
168    
169  }  }

Legend:
Removed from v.1578  
changed lines
  Added in v.1778

  ViewVC Help
Powered by ViewVC 1.1.20