Moved console stuff into the listener

This commit is contained in:
nossr50 2011-01-07 22:10:56 -08:00
parent 8f5073a447
commit 4249685208
2 changed files with 21 additions and 4 deletions

View File

@ -7,6 +7,25 @@ import java.util.logging.Logger;
//===================================================================== //=====================================================================
public class vListener extends PluginListener { public class vListener extends PluginListener {
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
//On console stuff
public boolean onConsoleCommand(String[] split) {
String args = etc.combineSplit(1, split, "");
//Return true if you don't want the server command to be parsed by the server.
String server = Colors.LightGreen + "[Server] " + Colors.DarkPurple;
if(split[0].equalsIgnoreCase("stop")){
vChat.gmsg(server + "Rebooting the server");
return false;
}
//Make say nicer
if(split[0].equalsIgnoreCase("say"))
{
//Send out the message
vChat.gmsg(server + args);
return true;
}
log.log(Level.INFO, split.toString());
return false;
}
//===================================================================== //=====================================================================
//Function: disable //Function: disable
@ -139,8 +158,7 @@ public class vListener extends PluginListener {
if (block.getStatus() == 3){ if (block.getStatus() == 3){
int x, int x,
y, y,
z, z;
g;
x = block.getX(); x = block.getX();
y = block.getY(); y = block.getY();
z = block.getZ(); z = block.getZ();

View File

@ -20,10 +20,9 @@ public class vMinecraft extends Plugin {
//And remove the commands here. //And remove the commands here.
} }
@Override
public void initialize() { public void initialize() {
//Here we add the hook we're going to use. In this case it's the arm swing event. //Here we add the hook we're going to use. In this case it's the arm swing event.
etc.getLoader().addListener(PluginLoader.Hook.SERVERCOMMAND, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.SERVERCOMMAND, listener, this, PluginListener.Priority.CRITICAL);
etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.LOGIN, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.LOGIN, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH);