mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Blocked access to ColouredConsoleSenders constructor, implemented getConsoleSender
This commit is contained in:
parent
0118a20d6a
commit
44136f2e7d
@ -81,6 +81,10 @@ public class BlockSapling extends BlockFlower {
|
|||||||
public int getTypeId(int x, int y, int z) {
|
public int getTypeId(int x, int y, int z) {
|
||||||
return this.world.getTypeId(x, y, z);
|
return this.world.getTypeId(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return world.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ import java.net.UnknownHostException;
|
|||||||
import jline.ConsoleReader;
|
import jline.ConsoleReader;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.LoggerOutputStream;
|
import org.bukkit.craftbukkit.LoggerOutputStream;
|
||||||
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
|
||||||
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||||
import org.bukkit.craftbukkit.util.ServerShutdownThread;
|
import org.bukkit.craftbukkit.util.ServerShutdownThread;
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
@ -59,7 +59,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||||
public CraftServer server;
|
public CraftServer server;
|
||||||
public OptionSet options;
|
public OptionSet options;
|
||||||
public ColouredConsoleSender console;
|
public ConsoleCommandSender console;
|
||||||
public ConsoleReader reader;
|
public ConsoleReader reader;
|
||||||
public static int currentTick;
|
public static int currentTick;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -50,7 +50,7 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
||||||
minecraftserver.server = new CraftServer(minecraftserver, this);
|
minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||||
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
|
minecraftserver.console = ColouredConsoleSender.getInstance();
|
||||||
this.cserver = minecraftserver.server;
|
this.cserver = minecraftserver.server;
|
||||||
// CraftBukkit end
|
// 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));
|
this.manager = new PlayerManager(minecraftserver, this.dimension, minecraftserver.propertyManager.getInt("view-distance", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
public final int dimension;
|
public final int dimension;
|
||||||
public EntityTracker tracker;
|
public EntityTracker tracker;
|
||||||
public PlayerManager manager;
|
public PlayerManager manager;
|
||||||
|
@ -839,4 +839,8 @@ public final class CraftServer implements Server {
|
|||||||
((CraftWorld)world).getHandle().worldData.setGameType(mode.getValue());
|
((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.ANSIBuffer.ANSICodes;
|
||||||
import jline.ConsoleReader;
|
import jline.ConsoleReader;
|
||||||
import jline.Terminal;
|
import jline.Terminal;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
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 Map<ChatColor, String> replacements = new EnumMap<ChatColor, String>(ChatColor.class);
|
||||||
private final ChatColor[] colors = ChatColor.values();
|
private final ChatColor[] colors = ChatColor.values();
|
||||||
|
|
||||||
public ColouredConsoleSender(CraftServer server) {
|
protected ColouredConsoleSender(CraftServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
this.reader = server.getReader();
|
this.reader = server.getReader();
|
||||||
this.terminal = reader.getTerminal();
|
this.terminal = reader.getTerminal();
|
||||||
@ -55,4 +56,12 @@ public class ColouredConsoleSender extends ConsoleCommandSender {
|
|||||||
super.sendMessage(message);
|
super.sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ConsoleCommandSender getInstance() {
|
||||||
|
if (Bukkit.getConsoleSender() != null) {
|
||||||
|
return Bukkit.getConsoleSender();
|
||||||
|
} else {
|
||||||
|
return new ColouredConsoleSender((CraftServer)Bukkit.getServer());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user