From 44e172369fa27266f4c5b4c7d1649077fbf152db Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 7 Jan 2011 21:34:42 -0800 Subject: [PATCH] Added some barebones console interaction --- vConsole.java | 19 +++++++++++++++++++ vMinecraft.java | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 vConsole.java diff --git a/vConsole.java b/vConsole.java new file mode 100644 index 000000000..879fbf4f4 --- /dev/null +++ b/vConsole.java @@ -0,0 +1,19 @@ +public class vConsole { +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; + } + return false; + } +} \ No newline at end of file diff --git a/vMinecraft.java b/vMinecraft.java index b7fc742ba..e615c8087 100644 --- a/vMinecraft.java +++ b/vMinecraft.java @@ -20,8 +20,10 @@ public class vMinecraft extends Plugin { //And remove the commands here. } + @Override public void initialize() { //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.CHAT, 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);