mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-25 06:53:37 +00:00
We can get the console command sender from server object now.
This commit is contained in:
parent
55fc8bdd57
commit
06900e19f0
2 changed files with 22 additions and 19 deletions
|
@ -2,33 +2,35 @@ package com.earth2me.essentials;
|
|||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public final class Console implements IReplyTo {
|
||||
|
||||
public final 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(Util.i18n("invalidServer"));
|
||||
}
|
||||
return ((CraftServer)server).getServer().console;
|
||||
|
||||
private Console()
|
||||
{
|
||||
}
|
||||
|
||||
public void setReplyTo(CommandSender user) {
|
||||
public static CommandSender getCommandSender(Server server) throws Exception
|
||||
{
|
||||
return server.getConsoleSender();
|
||||
}
|
||||
|
||||
public void setReplyTo(CommandSender user)
|
||||
{
|
||||
replyTo = user;
|
||||
}
|
||||
|
||||
public CommandSender getReplyTo() {
|
||||
public CommandSender getReplyTo()
|
||||
{
|
||||
return replyTo;
|
||||
}
|
||||
|
||||
public static Console getConsoleReplyTo() {
|
||||
|
||||
public static Console getConsoleReplyTo()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue