2021-03-15 23:00:00 +01:00
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
2018-08-12 08:33:39 +02:00
@@ -54,20 +54,31 @@
2024-12-11 22:26:55 +01:00
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
-import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.level.storage.LevelStorageSource;
2022-02-28 16:00:00 +01:00
import org.slf4j.Logger;
2014-11-25 22:32:16 +01:00
+// CraftBukkit start
2022-12-07 17:00:00 +01:00
+import net.minecraft.server.WorldLoader;
2014-11-25 22:32:16 +01:00
+import org.apache.logging.log4j.Level;
2022-02-28 16:00:00 +01:00
+import org.apache.logging.log4j.LogManager;
2020-09-12 01:05:20 +02:00
+import org.apache.logging.log4j.io.IoBuilder;
2018-07-15 02:00:00 +02:00
+import org.bukkit.command.CommandSender;
2024-04-07 03:54:28 +02:00
+import org.bukkit.craftbukkit.util.TerminalCompletionHandler;
+import org.bukkit.craftbukkit.util.TerminalConsoleWriterThread;
2014-11-25 22:32:16 +01:00
+import org.bukkit.event.server.ServerCommandEvent;
2015-02-26 23:41:06 +01:00
+import org.bukkit.event.server.RemoteServerCommandEvent;
2014-11-25 22:32:16 +01:00
+// CraftBukkit end
+
2024-12-11 22:26:55 +01:00
public class DedicatedServer extends MinecraftServer implements ServerInterface {
2014-11-25 22:32:16 +01:00
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;
2023-09-21 18:40:00 +02:00
+ // private final RemoteControlCommandListener 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;
2016-03-03 11:00:11 +01:00
@@ -81,33 +92,99 @@
2024-04-23 17:15:00 +02:00
private DebugSampleSubscriptionTracker debugSampleSubscriptionTracker;
2024-06-13 17:05:00 +02:00
public ServerLinks serverLinks;
2016-02-29 22:32:46 +01:00
2024-12-11 22:26:55 +01:00
- public DedicatedServer(Thread serverThread, LevelStorageSource.LevelStorageAccess session, PackRepository dataPackManager, WorldStem saveLoader, DedicatedServerSettings propertiesLoader, DataFixer dataFixer, Services apiServices, ChunkProgressListenerFactory worldGenerationProgressListenerFactory) {
- super(serverThread, session, dataPackManager, saveLoader, Proxy.NO_PROXY, dataFixer, apiServices, worldGenerationProgressListenerFactory);
- this.settings = propertiesLoader;
- this.rconConsoleSource = new RconConsoleSource(this);
- this.serverTextFilter = ServerTextFilter.createFromConfig(propertiesLoader.getProperties());
- this.serverLinks = DedicatedServer.createServerLinks(propertiesLoader);
2014-11-25 22:32:16 +01:00
+ // CraftBukkit start - Signature changed
2024-12-11 22:26:55 +01:00
+ public DedicatedServer(joptsimple.OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
2022-12-16 01:13:10 +01:00
+ super(options, worldLoader, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
2014-11-25 22:32:16 +01:00
+ // CraftBukkit end
2024-12-11 22:26:55 +01:00
+ this.settings = dedicatedserversettings;
2023-08-26 10:19:22 +02:00
+ // this.rconConsoleSource = new RemoteControlCommandListener(this); // CraftBukkit - remove field
2024-12-11 22:26:55 +01:00
+ this.serverTextFilter = ServerTextFilter.createFromConfig(dedicatedserversettings.getProperties());
+ this.serverLinks = DedicatedServer.createServerLinks(dedicatedserversettings);
2023-08-26 10:19:22 +02:00
}
2024-12-11 22:26:55 +01:00
@Override
2021-11-21 23:00:00 +01:00
public boolean initServer() throws IOException {
2015-02-26 23:41:06 +01:00
Thread thread = new Thread("Server console handler") {
public void run() {
2017-05-14 04:00:00 +02:00
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ 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-11 22:26:55 +01:00
+
2015-02-26 23:41:06 +01:00
String s;
try {
- while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning() && (s = bufferedreader.readLine()) != null) {
2021-11-21 23:00:00 +01:00
- DedicatedServer.this.handleConsoleInput(s, 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) {
+ s = bufferedreader.readLine(">", null);
+ } else {
+ s = bufferedreader.readLine();
+ }
2019-07-28 00:49:01 +02:00
+
+ // SPIGOT-5220: Throttle if EOF (ctrl^d) or stdin is /dev/null
+ if (s == null) {
+ try {
+ Thread.sleep(50L);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ continue;
+ }
+ if (s.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
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
2017-06-09 19:03:43 +02:00
}
+ */
+ // Paper end
2015-05-25 14:04:32 +02:00
}
};
2015-02-26 23:41:06 +01: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
+ final org.apache.logging.log4j.Logger logger = LogManager.getRootLogger();
+ /*
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
+
2020-09-12 01:05:20 +02:00
+ System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
+ System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
2014-11-25 22:32:16 +01:00
+ // CraftBukkit end
+
2015-05-25 14:04:32 +02:00
thread.setDaemon(true);
2018-07-15 02:00:00 +02:00
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
2015-05-25 14:04:32 +02:00
thread.start();
2018-08-08 21:30:52 +02:00
@@ -126,13 +203,27 @@
2013-07-07 01:32:53 +02:00
this.setPreventProxyConnections(dedicatedserverproperties.preventProxyConnections);
this.setLocalIp(dedicatedserverproperties.serverIp);
}
+ // 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
2018-08-08 21:30:52 +02:00
+ org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
2016-03-01 04:02:09 +01:00
+ io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
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
2013-07-07 01:32:53 +02:00
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
2021-06-11 07:00:00 +02:00
this.setMotd(dedicatedserverproperties.motd);
2021-11-21 23:00:00 +01:00
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
2021-07-06 16:00:00 +02:00
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
2021-06-11 07:00:00 +02:00
- this.worldData.setGameType(dedicatedserverproperties.gamemode);
+ // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
2020-06-25 02:00:00 +02:00
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
2018-08-12 08:33:39 +02:00
@@ -155,22 +246,35 @@
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
2019-04-23 04:00:00 +02:00
return false;
2014-11-25 22:32:16 +01:00
}
2018-08-12 08:33:39 +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
2018-08-12 08:33:39 +02:00
2021-11-21 23:00:00 +01:00
if (!this.usesAuthentication()) {
2019-04-23 04:00:00 +02:00
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
2014-04-12 13:23:58 +02:00
- DedicatedServer.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.");
+ // Spigot start
+ if (org.spigotmc.SpigotConfig.bungee) {
+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
+ DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
+ } else {
+ DedicatedServer.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.");
+ }
+ // Spigot end
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
2016-05-17 02:47:41 +02:00
if (this.convertOldUsers()) {
- this.getProfileCache().save();
+ this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
}
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());
this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME);
2024-12-11 22:26:55 +01:00
long i = Util.getNanos();
2018-08-08 21:30:52 +02:00
@@ -178,13 +282,13 @@
2024-12-11 22:26:55 +01:00
SkullBlockEntity.setup(this.services, this);
GameProfileCache.setUsesAuthentication(this.usesAuthentication());
2021-11-21 23:00:00 +01:00
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
- this.loadLevel();
2024-12-11 22:26:55 +01:00
+ this.loadLevel(this.storageSource.getLevelId()); // CraftBukkit
long j = Util.getNanos() - i;
2020-06-25 02:00:00 +02:00
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
2024-02-04 00:54:20 +01:00
DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s);
if (dedicatedserverproperties.announcePlayerAchievements != null) {
2024-12-11 22:26:55 +01:00
- ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this);
+ ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this.overworld()); // CraftBukkit - per-world
2024-02-04 00:54:20 +01:00
}
if (dedicatedserverproperties.enableQuery) {
2018-08-08 21:30:52 +02:00
@@ -197,7 +301,7 @@
2014-08-05 18:20:19 +02:00
this.rconThread = RconThread.create(this);
}
- if (this.getMaxTickLength() > 0L) {
+ if (false && this.getMaxTickLength() > 0L) { // Spigot - disable
Thread thread1 = new Thread(new ServerWatchdog(this));
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(DedicatedServer.LOGGER));
2018-08-12 08:33:39 +02:00
@@ -215,6 +319,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();
2020-06-28 09:59:10 +02:00
@@ -227,7 +337,7 @@
@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
2020-03-31 09:50:42 +02:00
@@ -286,13 +396,14 @@
}
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
}
2014-11-25 22:32:16 +01:00
2019-04-23 04:00:00 +02:00
+ System.exit(0); // CraftBukkit
2014-11-25 22:32:16 +01:00
}
2019-04-23 04:00:00 +02:00
@Override
2018-08-12 08:33:39 +02:00
@@ -302,19 +413,29 @@
2024-12-11 22:26:55 +01:00
}
@Override
- public boolean isLevelEnabled(Level world) {
- return world.dimension() == Level.NETHER ? this.getProperties().allowNether : true;
+ public boolean isLevelEnabled(net.minecraft.world.level.Level world) {
+ return world.dimension() == net.minecraft.world.level.Level.NETHER ? this.getProperties().allowNether : true;
}
public void handleConsoleInput(String command, CommandSourceStack commandSource) {
2018-08-12 08:33:39 +02:00
- this.consoleInput.add(new ConsoleInput(command, commandSource));
+ this.serverCommandQueue.add(new ConsoleInput(command, commandSource)); // Paper - Perf: use proper queue
}
public void handleConsoleInputs() {
- while (!this.consoleInput.isEmpty()) {
- ConsoleInput servercommand = (ConsoleInput) this.consoleInput.remove(0);
+ // 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
2022-06-07 18:00:00 +02:00
- this.getCommands().performPrefixedCommand(servercommand.source, servercommand.msg);
2014-11-25 22:32:16 +01:00
+ // CraftBukkit start - ServerCommand for preprocessing
2024-12-11 22:26:55 +01:00
+ ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.msg);
+ 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
}
}
2018-08-12 08:33:39 +02:00
@@ -383,7 +504,7 @@
2024-12-11 22:26:55 +01:00
@Override
public boolean isUnderSpawnProtection(ServerLevel world, BlockPos pos, Player player) {
- if (world.dimension() != Level.OVERWORLD) {
+ if (world.dimension() != net.minecraft.world.level.Level.OVERWORLD) {
return false;
} else if (this.getPlayerList().getOps().isEmpty()) {
return false;
2018-08-12 08:33:39 +02:00
@@ -453,7 +574,11 @@
2016-08-05 01:03:08 +02:00
public boolean enforceSecureProfile() {
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.canValidateProfileKeys();
+ // Paper start - Add setting for proxy online mode status
+ return dedicatedserverproperties.enforceSecureProfile
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
+ && this.services.canValidateProfileKeys();
+ // Paper end - Add setting for proxy online mode status
}
@Override
2018-08-12 08:33:39 +02:00
@@ -541,16 +666,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();
+ // 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();
2021-11-21 23:00:00 +01:00
this.executeBlocking(() -> {
2024-12-11 22:26:55 +01:00
- this.getCommands().performPrefixedCommand(this.rconConsoleSource.createCommandSourceStack(), command);
+ CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack();
2023-08-26 10:19:22 +02:00
+ RemoteServerCommandEvent event = new 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);
2019-06-21 12:00:00 +02:00
});
2023-08-26 10:19:22 +02:00
- return this.rconConsoleSource.getCommandResponse();
+ return rconConsoleSource.getCommandResponse();
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
}
2023-08-26 10:19:22 +02:00
2024-12-11 22:26:55 +01:00
public void storeUsingWhiteList(boolean useWhitelist) {
2018-08-12 08:33:39 +02:00
@@ -660,4 +821,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-11 22:26:55 +01:00
+ public CommandSender getBukkitSender(CommandSourceStack wrapper) {
+ return this.console;
2019-04-23 04:00:00 +02:00
+ }
2016-02-29 22:32:46 +01:00
+ // CraftBukkit end
}