2021-03-15 23:00:00 +01:00
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
2024-12-14 23:57:57 +01:00
@@ -63,10 +_,10 @@
2022-02-28 16:00:00 +01:00
static final Logger LOGGER = LogUtils.getLogger();
2018-08-12 08:33:39 +02:00
private static final int CONVERSION_RETRY_DELAY_MS = 5000;
private static final int CONVERSION_RETRIES = 2;
- private final List<ConsoleInput> consoleInput = Collections.synchronizedList(Lists.newArrayList());
+ private final java.util.Queue<ConsoleInput> serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - Perf: use a proper queue
2023-08-26 10:19:22 +02:00
@Nullable
2024-12-11 22:26:55 +01:00
private QueryThreadGs4 queryThreadGs4;
- private final RconConsoleSource rconConsoleSource;
2024-12-14 23:57:57 +01:00
+ // private final RconConsoleSource rconConsoleSource; // CraftBukkit - remove field
2023-08-26 10:19:22 +02:00
@Nullable
2024-12-11 22:26:55 +01:00
private RconThread rconThread;
2023-08-26 10:19:22 +02:00
public DedicatedServerSettings settings;
2024-12-15 12:13:09 +01:00
@@ -81,6 +_,7 @@
2024-06-13 17:05:00 +02:00
public ServerLinks serverLinks;
2016-02-29 22:32:46 +01:00
2024-12-15 12:13:09 +01:00
public DedicatedServer(
+ joptsimple.OptionSet options, net.minecraft.server.WorldLoader.DataLoadContext worldLoader, // CraftBukkit - Signature changed
Thread serverThread,
LevelStorageSource.LevelStorageAccess storageSource,
PackRepository packRepository,
@@ -90,9 +_,9 @@
Services services,
ChunkProgressListenerFactory progressListenerFactory
) {
2024-12-14 23:57:57 +01:00
- super(serverThread, storageSource, packRepository, worldStem, Proxy.NO_PROXY, fixerUpper, services, progressListenerFactory);
2024-12-15 12:13:09 +01:00
+ super(options, worldLoader, serverThread, storageSource, packRepository, worldStem, Proxy.NO_PROXY, fixerUpper, services, progressListenerFactory); // CraftBukkit - Signature changed
2024-12-14 23:57:57 +01:00
this.settings = settings;
- this.rconConsoleSource = new RconConsoleSource(this);
+ //this.rconConsoleSource = new RconConsoleSource(this); // CraftBukkit - remove field
this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties());
this.serverLinks = createServerLinks(settings);
2023-08-26 10:19:22 +02:00
}
2024-12-14 23:57:57 +01:00
@@ -102,26 +_,95 @@
2015-02-26 23:41:06 +01:00
Thread thread = new Thread("Server console handler") {
2024-12-14 23:57:57 +01:00
@Override
2015-02-26 23:41:06 +01:00
public void run() {
2024-12-14 23:57:57 +01:00
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
-
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
2024-12-14 23:57:57 +01:00
+ if (!org.bukkit.craftbukkit.Main.useConsole) return;
2017-06-09 19:03:43 +02:00
+ // Paper start - Use TerminalConsoleAppender
+ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
+ /*
2024-12-11 22:26:55 +01:00
+ jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader;
2020-01-28 00:36:47 +01:00
+ // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
+ try {
+ System.in.available();
+ } catch (IOException ex) {
+ return;
+ }
2015-02-26 23:41:06 +01:00
+ // CraftBukkit end
2024-12-14 23:57:57 +01:00
String string1;
2015-02-26 23:41:06 +01:00
try {
2024-12-14 23:57:57 +01:00
- while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning() && (string1 = bufferedReader.readLine()) != null) {
- DedicatedServer.this.handleConsoleInput(string1, DedicatedServer.this.createCommandSourceStack());
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start - JLine disabling compatibility
2018-07-15 02:00:00 +02:00
+ while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) {
2015-02-26 23:41:06 +01:00
+ if (org.bukkit.craftbukkit.Main.useJline) {
2024-12-14 23:57:57 +01:00
+ string1 = bufferedreader.readLine(">", null);
2015-02-26 23:41:06 +01:00
+ } else {
2024-12-14 23:57:57 +01:00
+ string1 = bufferedreader.readLine();
2015-02-26 23:41:06 +01:00
+ }
2019-07-28 00:49:01 +02:00
+
+ // SPIGOT-5220: Throttle if EOF (ctrl^d) or stdin is /dev/null
2024-12-14 23:57:57 +01:00
+ if (string1 == null) {
2019-07-28 00:49:01 +02:00
+ try {
+ Thread.sleep(50L);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ continue;
+ }
2024-12-14 23:57:57 +01:00
+ if (string1.trim().length() > 0) { // Trim to filter lines which are just spaces
2017-06-09 19:03:43 +02:00
+ DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener());
2015-02-26 23:41:06 +01:00
+ }
+ // CraftBukkit end
}
2024-12-14 23:57:57 +01:00
} catch (IOException var4) {
DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
2017-06-09 19:03:43 +02:00
}
+ */
+ // Paper end
2015-05-25 14:04:32 +02:00
}
};
2014-11-25 22:32:16 +01:00
+ // CraftBukkit start - TODO: handle command-line logging arguments
+ java.util.logging.Logger global = java.util.logging.Logger.getLogger("");
+ global.setUseParentHandlers(false);
+ for (java.util.logging.Handler handler : global.getHandlers()) {
+ global.removeHandler(handler);
+ }
+ global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
+
2017-06-09 19:03:43 +02:00
+ // Paper start - Not needed with TerminalConsoleAppender
2024-12-14 23:57:57 +01:00
+ final org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getRootLogger();
2017-06-09 19:03:43 +02:00
+ /*
2014-11-25 22:32:16 +01:00
+ final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
+ for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) {
+ if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
+ logger.removeAppender(appender);
+ }
+ }
+
2024-04-07 03:54:28 +02:00
+ TerminalConsoleWriterThread writerThread = new TerminalConsoleWriterThread(System.out, this.reader);
+ this.reader.setCompletionHandler(new TerminalCompletionHandler(writerThread, this.reader.getCompletionHandler()));
+ writerThread.start();
2017-06-09 19:03:43 +02:00
+ */
+ // Paper end - Not needed with TerminalConsoleAppender
2014-11-25 22:32:16 +01:00
+
2024-12-14 23:57:57 +01:00
+ System.setOut(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.INFO).buildPrintStream());
+ System.setErr(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.WARN).buildPrintStream());
2014-11-25 22:32:16 +01:00
+ // CraftBukkit end
2015-05-25 14:04:32 +02:00
thread.setDaemon(true);
2024-12-14 23:57:57 +01:00
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
2021-03-31 01:06:08 +02:00
- thread.start();
+ // thread.start(); // Paper - Enhance console tab completions for brigadier commands; moved down
2024-12-14 23:57:57 +01:00
LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName());
2021-03-31 01:06:08 +02:00
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
2024-12-14 23:57:57 +01:00
LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
2021-09-11 22:55:14 +02:00
}
+ // Paper start - detect running as root
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
2024-12-18 19:09:46 +01:00
+ LOGGER.warn("****************************");
+ LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
+ LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
+ LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
+ LOGGER.warn("****************************");
2021-09-11 22:55:14 +02:00
+ }
+ // Paper end - detect running as root
+
2024-12-14 23:57:57 +01:00
LOGGER.info("Loading properties");
DedicatedServerProperties properties = this.settings.getProperties();
if (this.isSingleplayer()) {
@@ -132,13 +_,51 @@
this.setLocalIp(properties.serverIp);
2013-07-07 01:32:53 +02:00
}
2024-12-14 23:57:57 +01:00
2013-07-07 01:32:53 +02:00
+ // Spigot start
+ this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage));
+ org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
+ org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end
2021-06-21 03:19:09 +02:00
+ io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
2022-06-09 07:20:16 +02:00
+ // Paper start - initialize global and world-defaults configuration
+ this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
+ this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
+ // Paper end - initialize global and world-defaults configuration
2024-07-16 23:55:23 +02:00
+ this.server.spark.enableEarlyIfRequested(); // Paper - spark
2021-01-05 04:49:15 +01:00
+ // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
+ if (this.convertOldUsers()) {
+ this.getProfileCache().save(false); // Paper
+ }
+ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
+ // Paper end - fix converting txt to json file
2018-08-08 21:30:52 +02:00
+ org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
2021-03-31 01:06:08 +02:00
+ thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
2016-03-01 04:02:09 +01:00
+ io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
2024-07-16 23:55:23 +02:00
+ this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
2017-03-25 05:56:01 +01:00
+ com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
2016-03-01 21:32:43 +01:00
+ com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
2024-12-14 23:57:57 +01:00
+
this.setPvpAllowed(properties.pvp);
this.setFlightAllowed(properties.allowFlight);
this.setMotd(properties.motd);
super.setPlayerIdleTimeout(properties.playerIdleTimeout.get());
this.setEnforceWhitelist(properties.enforceWhitelist);
- this.worldData.setGameType(properties.gamemode);
+ // this.worldData.setGameType(properties.gamemode); // CraftBukkit - moved to world loading
LOGGER.info("Default game type: {}", properties.gamemode);
2021-05-11 23:39:22 +02:00
+ // Paper start - Unix domain socket support
+ java.net.SocketAddress bindAddress;
+ if (this.getLocalIp().startsWith("unix:")) {
+ if (!io.netty.channel.epoll.Epoll.isAvailable()) {
2024-12-18 19:09:46 +01:00
+ LOGGER.error("**** INVALID CONFIGURATION!");
+ LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
2021-05-11 23:39:22 +02:00
+ return false;
+ } else if (!io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && !org.spigotmc.SpigotConfig.bungee) {
2024-12-18 19:09:46 +01:00
+ LOGGER.error("**** INVALID CONFIGURATION!");
+ LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
2021-05-11 23:39:22 +02:00
+ return false;
+ }
+ bindAddress = new io.netty.channel.unix.DomainSocketAddress(this.getLocalIp().substring("unix:".length()));
+ } else {
2024-12-14 23:57:57 +01:00
InetAddress inetAddress = null;
2021-05-11 23:39:22 +02:00
if (!this.getLocalIp().isEmpty()) {
2024-12-14 23:57:57 +01:00
inetAddress = InetAddress.getByName(this.getLocalIp());
@@ -147,36 +_,62 @@
2021-05-11 23:39:22 +02:00
if (this.getPort() < 0) {
2024-12-14 23:57:57 +01:00
this.setPort(properties.serverPort);
2021-05-11 23:39:22 +02:00
}
2024-12-14 23:57:57 +01:00
+ bindAddress = new java.net.InetSocketAddress(inetAddress, this.getPort());
2021-05-11 23:39:22 +02:00
+ }
+ // Paper end - Unix domain socket support
this.initializeKeyPair();
2024-12-14 23:57:57 +01:00
LOGGER.info("Starting Minecraft server on {}:{}", this.getLocalIp().isEmpty() ? "*" : this.getLocalIp(), this.getPort());
2021-05-11 23:39:22 +02:00
try {
2024-12-14 23:57:57 +01:00
- this.getConnection().startTcpServerListener(inetAddress, this.getPort());
2024-12-15 07:35:35 +01:00
+ this.getConnection().startTcpServerListener(bindAddress); // Paper - Unix domain socket support
2024-12-14 23:57:57 +01:00
} catch (IOException var10) {
LOGGER.warn("**** FAILED TO BIND TO PORT!");
LOGGER.warn("The exception was: {}", var10.toString());
LOGGER.warn("Perhaps a server is already running on that port?");
+ if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
2019-04-23 04:00:00 +02:00
return false;
2014-11-25 22:32:16 +01:00
}
2021-04-24 11:09:32 +02:00
2019-04-23 04:00:00 +02:00
+ // CraftBukkit start
2013-07-07 01:32:53 +02:00
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up
2024-12-11 22:26:55 +01:00
+ this.server.loadPlugins();
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
2019-04-23 04:00:00 +02:00
+ // CraftBukkit end
2021-04-24 11:09:32 +02:00
+
2018-10-08 20:36:14 +02:00
+ // Paper start - Add Velocity IP Forwarding Support
+ boolean usingProxy = org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled;
+ String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
+ String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
+ // Paper end - Add Velocity IP Forwarding Support
2021-11-21 23:00:00 +01:00
if (!this.usesAuthentication()) {
2024-12-14 23:57:57 +01:00
LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
- LOGGER.warn(
- "While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."
- );
2014-04-12 13:23:58 +02:00
+ // Spigot start
2018-10-08 20:36:14 +02:00
+ // Paper start - Add Velocity IP Forwarding Support
+ if (usingProxy) {
2024-12-18 19:09:46 +01:00
+ LOGGER.warn("Whilst this makes it possible to use {}, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.", proxyFlavor);
+ LOGGER.warn("Please see {} for further information.", proxyLink);
2024-12-14 23:57:57 +01:00
+ // Paper end - Add Velocity IP Forwarding Support
2014-04-12 13:23:58 +02:00
+ } else {
2024-12-18 19:09:46 +01:00
+ LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
2014-04-12 13:23:58 +02:00
+ }
+ // Spigot end
2024-12-14 23:57:57 +01:00
LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
2014-04-12 13:23:58 +02:00
}
2024-12-14 23:57:57 +01:00
+ // CraftBukkit start
+ /*
if (this.convertOldUsers()) {
this.getProfileCache().save();
}
+ */
+ // CraftBukkit end
2016-05-17 02:47:41 +02:00
2024-12-11 22:26:55 +01:00
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
2019-04-23 04:00:00 +02:00
return false;
} else {
2022-12-07 17:00:00 +01:00
- this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage));
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // CraftBukkit - moved up
2024-04-23 17:15:00 +02:00
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
2024-12-14 23:57:57 +01:00
this.tickTimeLogger = new RemoteSampleLogger(
TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME
@@ -185,12 +_,12 @@
2024-12-11 22:26:55 +01:00
SkullBlockEntity.setup(this.services, this);
GameProfileCache.setUsesAuthentication(this.usesAuthentication());
2024-12-14 23:57:57 +01:00
LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
2021-11-21 23:00:00 +01:00
- this.loadLevel();
2024-12-11 22:26:55 +01:00
+ this.loadLevel(this.storageSource.getLevelId()); // CraftBukkit
2024-12-14 23:57:57 +01:00
long l = Util.getNanos() - nanos;
String string = String.format(Locale.ROOT, "%.3fs", l / 1.0E9);
2024-12-21 13:45:04 +01:00
- LOGGER.info("Done ({})! For help, type \"help\"", string);
+ LOGGER.info("Done preparing level \"{}\" ({})", this.getLevelIdName(), string); // Paper - Improve startup message, add total time
2024-12-14 23:57:57 +01:00
if (properties.announcePlayerAchievements != null) {
- this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS).set(properties.announcePlayerAchievements, this);
+ this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS).set(properties.announcePlayerAchievements, this.overworld()); // CraftBukkit - per-world
2024-02-04 00:54:20 +01:00
}
2024-12-14 23:57:57 +01:00
if (properties.enableQuery) {
@@ -203,7 +_,7 @@
2014-08-05 18:20:19 +02:00
this.rconThread = RconThread.create(this);
}
- if (this.getMaxTickLength() > 0L) {
2024-12-14 23:57:57 +01:00
+ if (false && this.getMaxTickLength() > 0L) { // Spigot - disable
2014-08-05 18:20:19 +02:00
Thread thread1 = new Thread(new ServerWatchdog(this));
2024-12-14 23:57:57 +01:00
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(LOGGER));
thread1.setName("Server Watchdog");
@@ -220,6 +_,12 @@
2016-08-05 01:03:08 +02:00
}
2018-08-12 08:33:39 +02:00
}
2022-10-30 00:22:32 +02:00
+ // Paper start
+ public java.io.File getPluginsFolder() {
+ return (java.io.File) this.options.valueOf("plugins");
2018-08-12 08:33:39 +02:00
+ }
2022-10-30 00:22:32 +02:00
+ // Paper end
2018-08-12 08:33:39 +02:00
+
2022-10-30 00:22:32 +02:00
@Override
public boolean isSpawningMonsters() {
2018-08-12 08:33:39 +02:00
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
2024-12-14 23:57:57 +01:00
@@ -232,7 +_,7 @@
2020-06-28 09:59:10 +02:00
@Override
public void forceDifficulty() {
- this.setDifficulty(this.getProperties().difficulty, true);
+ // this.setDifficulty(this.getProperties().difficulty, true); // Paper - per level difficulty; Don't overwrite level.dat's difficulty, keep current
}
@Override
2024-12-17 13:32:46 +01:00
@@ -271,12 +_,15 @@
2020-03-31 09:50:42 +02:00
}
if (this.rconThread != null) {
- this.rconThread.stop();
+ this.rconThread.stopNonBlocking(); // Paper - don't wait for remote connections
}
if (this.queryThreadGs4 != null) {
- this.queryThreadGs4.stop();
+ // this.remoteStatusListener.stop(); // Paper - don't wait for remote connections
2019-04-23 04:00:00 +02:00
}
2024-12-14 23:57:57 +01:00
+
2024-12-17 13:32:46 +01:00
+ this.hasFullyShutdown = true; // Paper - Improved watchdog support
2024-12-21 13:45:04 +01:00
+ System.exit(this.abnormalExit ? 70 : 0); // CraftBukkit // Paper - Improved watchdog support
2014-11-25 22:32:16 +01:00
}
2019-04-23 04:00:00 +02:00
@Override
2024-12-14 23:57:57 +01:00
@@ -291,13 +_,23 @@
2024-12-11 22:26:55 +01:00
}
2024-12-14 23:57:57 +01:00
public void handleConsoleInput(String msg, CommandSourceStack source) {
- this.consoleInput.add(new ConsoleInput(msg, source));
+ this.serverCommandQueue.add(new ConsoleInput(msg, source)); // Paper - Perf: use proper queue
2018-08-12 08:33:39 +02:00
}
public void handleConsoleInputs() {
- while (!this.consoleInput.isEmpty()) {
2024-12-14 23:57:57 +01:00
- ConsoleInput consoleInput = this.consoleInput.remove(0);
- this.getCommands().performPrefixedCommand(consoleInput.source, consoleInput.msg);
2018-08-12 08:33:39 +02:00
+ // Paper start - Perf: use proper queue
+ ConsoleInput servercommand;
+ while ((servercommand = this.serverCommandQueue.poll()) != null) {
+ // Paper end - Perf: use proper queue
2014-11-25 22:32:16 +01:00
+ // CraftBukkit start - ServerCommand for preprocessing
2024-12-14 23:57:57 +01:00
+ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(this.console, servercommand.msg);
2024-12-11 22:26:55 +01:00
+ this.server.getPluginManager().callEvent(event);
2016-03-03 06:56:07 +01:00
+ if (event.isCancelled()) continue;
2024-12-11 22:26:55 +01:00
+ servercommand = new ConsoleInput(event.getCommand(), servercommand.source);
2014-11-25 22:32:16 +01:00
+
2022-06-07 18:00:00 +02:00
+ // this.getCommands().performPrefixedCommand(servercommand.source, servercommand.msg); // Called in dispatchServerCommand
2024-12-11 22:26:55 +01:00
+ this.server.dispatchServerCommand(this.console, servercommand);
2014-11-25 22:32:16 +01:00
+ // CraftBukkit end
}
}
2024-12-11 22:26:55 +01:00
2024-12-14 23:57:57 +01:00
@@ -430,7 +_,11 @@
2024-12-11 22:26:55 +01:00
@Override
2016-08-05 01:03:08 +02:00
public boolean enforceSecureProfile() {
2024-12-14 23:57:57 +01:00
DedicatedServerProperties properties = this.getProperties();
- return properties.enforceSecureProfile && properties.onlineMode && this.services.canValidateProfileKeys();
2016-08-05 01:03:08 +02:00
+ // Paper start - Add setting for proxy online mode status
2024-12-14 23:57:57 +01:00
+ return properties.enforceSecureProfile
2016-08-05 01:03:08 +02:00
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
+ && this.services.canValidateProfileKeys();
+ // Paper end - Add setting for proxy online mode status
}
@Override
2024-12-14 23:57:57 +01:00
@@ -515,14 +_,52 @@
2015-02-26 23:41:06 +01:00
2019-04-23 04:00:00 +02:00
@Override
2021-11-21 23:00:00 +01:00
public String getPluginNames() {
2015-02-26 23:41:06 +01:00
- return "";
+ // CraftBukkit start - Whole method
+ StringBuilder result = new StringBuilder();
2024-12-11 22:26:55 +01:00
+ org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
2015-02-26 23:41:06 +01:00
+
2024-12-11 22:26:55 +01:00
+ result.append(this.server.getName());
2015-02-26 23:41:06 +01:00
+ result.append(" on Bukkit ");
2024-12-11 22:26:55 +01:00
+ result.append(this.server.getBukkitVersion());
2015-02-26 23:41:06 +01:00
+
2024-12-11 22:26:55 +01:00
+ if (plugins.length > 0 && this.server.getQueryPlugins()) {
2015-02-26 23:41:06 +01:00
+ result.append(": ");
+
+ for (int i = 0; i < plugins.length; i++) {
+ if (i > 0) {
+ result.append("; ");
+ }
2018-09-19 10:32:21 +02:00
+
2016-07-15 12:08:04 +02:00
+ result.append(plugins[i].getDescription().getName());
+ result.append(" ");
+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
+ }
+ }
2018-12-13 01:00:00 +01:00
+
2015-02-26 23:41:06 +01:00
+ return result.toString();
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
}
@Override
2024-12-11 22:26:55 +01:00
public String runCommand(String command) {
2023-08-26 10:19:22 +02:00
- this.rconConsoleSource.prepareForCommand();
2024-12-14 23:57:57 +01:00
- this.executeBlocking(() -> this.getCommands().performPrefixedCommand(this.rconConsoleSource.createCommandSourceStack(), command));
- return this.rconConsoleSource.getCommandResponse();
2023-08-26 10:19:22 +02:00
+ // CraftBukkit start - fire RemoteServerCommandEvent
+ throw new UnsupportedOperationException("Not supported - remote source required.");
+ }
+
2024-12-11 22:26:55 +01:00
+ public String runCommand(RconConsoleSource rconConsoleSource, String s) {
2023-08-26 10:19:22 +02:00
+ rconConsoleSource.prepareForCommand();
2024-12-14 23:57:57 +01:00
+ this.executeBlocking(() -> {
2024-12-11 22:26:55 +01:00
+ CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack();
2024-12-14 23:57:57 +01:00
+ org.bukkit.event.server.RemoteServerCommandEvent event = new org.bukkit.event.server.RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s);
2024-12-11 22:26:55 +01:00
+ this.server.getPluginManager().callEvent(event);
2019-06-21 12:00:00 +02:00
+ if (event.isCancelled()) {
+ return;
2015-02-26 23:41:06 +01:00
+ }
2024-12-11 22:26:55 +01:00
+ ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper);
+ this.server.dispatchServerCommand(event.getSender(), serverCommand);
2024-12-14 23:57:57 +01:00
+ });
2023-08-26 10:19:22 +02:00
+ return rconConsoleSource.getCommandResponse();
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
}
2023-08-26 10:19:22 +02:00
2024-12-14 23:57:57 +01:00
public void storeUsingWhiteList(boolean isStoreUsingWhiteList) {
2024-12-21 13:45:04 +01:00
@@ -532,7 +_,7 @@
@Override
public void stopServer() {
super.stopServer();
- Util.shutdownExecutors();
+ //Util.shutdownExecutors(); // Paper - Improved watchdog support; moved into super
SkullBlockEntity.clear();
}
2024-12-14 23:57:57 +01:00
@@ -626,4 +_,15 @@
2024-06-13 17:05:00 +02:00
}
}
2019-04-23 04:00:00 +02:00
}
2016-02-29 22:32:46 +01:00
+
+ // CraftBukkit start
2019-04-23 04:00:00 +02:00
+ public boolean isDebugging() {
2021-11-21 23:00:00 +01:00
+ return this.getProperties().debug;
2019-04-23 04:00:00 +02:00
+ }
+
2018-07-15 02:00:00 +02:00
+ @Override
2024-12-15 05:15:49 +01:00
+ public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) {
2024-12-11 22:26:55 +01:00
+ return this.console;
2019-04-23 04:00:00 +02:00
+ }
2016-02-29 22:32:46 +01:00
+ // CraftBukkit end
}