[trunk] /msg /r Reply to the console. Add /r console command.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1129 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-05 15:57:54 +00:00
parent dbc653edb8
commit 57b5af7829
5 changed files with 89 additions and 54 deletions

View file

@ -0,0 +1,34 @@
package com.earth2me.essentials;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
public class Console implements IReplyTo {
private static Console instance = new Console();
private CommandSender replyTo;
public final static String NAME = "Console";
private Console() {
}
public static CommandSender getCommandSender(Server server) throws Exception {
if (! (server instanceof CraftServer)) {
throw new Exception("Invalid server!");
}
return ((CraftServer)server).getServer().console;
}
public void setReplyTo(CommandSender user) {
replyTo = user;
}
public CommandSender getReplyTo() {
return replyTo;
}
public static Console getConsoleReplyTo() {
return instance;
}
}