geforkt von Mirrors/Paper
Implement new interface ConsoleCommandSender.
Also use abstracted ServerCommandSender to reduce complexity! Yay!
Dieser Commit ist enthalten in:
Ursprung
93a4a9ba8c
Commit
4e318dd1c8
@ -1,6 +1,8 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.bukkit.craftbukkit.command.CraftConsoleCommandSender;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import com.avaje.ebean.config.DataSourceConfig;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
|
@ -10,15 +10,15 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public class ColouredConsoleSender extends ConsoleCommandSender {
|
||||
public class ColouredConsoleSender extends CraftConsoleCommandSender {
|
||||
private final ConsoleReader reader;
|
||||
private final Terminal terminal;
|
||||
private final Map<ChatColor, String> replacements = new EnumMap<ChatColor, String>(ChatColor.class);
|
||||
private final ChatColor[] colors = ChatColor.values();
|
||||
|
||||
protected ColouredConsoleSender(CraftServer server) {
|
||||
super(server);
|
||||
this.reader = server.getReader();
|
||||
protected ColouredConsoleSender() {
|
||||
super();
|
||||
this.reader = ((CraftServer) getServer()).getReader();
|
||||
this.terminal = reader.getTerminal();
|
||||
|
||||
replacements.put(ChatColor.BLACK, ANSICodes.attrib(0));
|
||||
@ -61,7 +61,7 @@ public class ColouredConsoleSender extends ConsoleCommandSender {
|
||||
if (Bukkit.getConsoleSender() != null) {
|
||||
return Bukkit.getConsoleSender();
|
||||
} else {
|
||||
return new ColouredConsoleSender((CraftServer)Bukkit.getServer());
|
||||
return new ColouredConsoleSender();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package org.bukkit.craftbukkit.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
/**
|
||||
* Represents CLI input from a console
|
||||
*/
|
||||
public class CraftConsoleCommandSender extends ServerCommandSender implements ConsoleCommandSender {
|
||||
|
||||
protected CraftConsoleCommandSender() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void sendMessage(String message) {
|
||||
System.out.println(ChatColor.stripColor(message));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "CONSOLE";
|
||||
}
|
||||
|
||||
public boolean isOp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setOp(boolean value) {
|
||||
throw new UnsupportedOperationException("Cannot change operator status of server console");
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren