geforkt von Mirrors/Paper
Blocked access to ColouredConsoleSenders constructor, implemented getConsoleSender
Dieser Commit ist enthalten in:
Ursprung
0118a20d6a
Commit
44136f2e7d
@ -81,6 +81,10 @@ public class BlockSapling extends BlockFlower {
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return this.world.getTypeId(x, y, z);
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return world.height;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ import java.net.UnknownHostException;
|
||||
import jline.ConsoleReader;
|
||||
import joptsimple.OptionSet;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.LoggerOutputStream;
|
||||
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
||||
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||
import org.bukkit.craftbukkit.util.ServerShutdownThread;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
@ -59,7 +59,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||
public CraftServer server;
|
||||
public OptionSet options;
|
||||
public ColouredConsoleSender console;
|
||||
public ConsoleCommandSender console;
|
||||
public ConsoleReader reader;
|
||||
public static int currentTick;
|
||||
// CraftBukkit end
|
||||
|
@ -50,7 +50,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
||||
minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
|
||||
minecraftserver.console = ColouredConsoleSender.getInstance();
|
||||
this.cserver = minecraftserver.server;
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -32,6 +32,10 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
this.manager = new PlayerManager(minecraftserver, this.dimension, minecraftserver.propertyManager.getInt("view-distance", 10));
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public final int dimension;
|
||||
public EntityTracker tracker;
|
||||
public PlayerManager manager;
|
||||
|
@ -839,4 +839,8 @@ public final class CraftServer implements Server {
|
||||
((CraftWorld)world).getHandle().worldData.setGameType(mode.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public ConsoleCommandSender getConsoleSender() {
|
||||
return console.console;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.Map;
|
||||
import jline.ANSIBuffer.ANSICodes;
|
||||
import jline.ConsoleReader;
|
||||
import jline.Terminal;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -15,7 +16,7 @@ public class ColouredConsoleSender extends ConsoleCommandSender {
|
||||
private final Map<ChatColor, String> replacements = new EnumMap<ChatColor, String>(ChatColor.class);
|
||||
private final ChatColor[] colors = ChatColor.values();
|
||||
|
||||
public ColouredConsoleSender(CraftServer server) {
|
||||
protected ColouredConsoleSender(CraftServer server) {
|
||||
super(server);
|
||||
this.reader = server.getReader();
|
||||
this.terminal = reader.getTerminal();
|
||||
@ -55,4 +56,12 @@ public class ColouredConsoleSender extends ConsoleCommandSender {
|
||||
super.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static ConsoleCommandSender getInstance() {
|
||||
if (Bukkit.getConsoleSender() != null) {
|
||||
return Bukkit.getConsoleSender();
|
||||
} else {
|
||||
return new ColouredConsoleSender((CraftServer)Bukkit.getServer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren