mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 20:53:09 +01:00
da9d110d5b
This patch does not appear to be doing anything useful, and may hide errors. Currently, the save logic does not run through this path either so it did not do anything. Additionally, properly implement support for handling RegionFileSizeException in Moonrise.
38 lines
2.2 KiB
Diff
38 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 12 Aug 2018 02:33:39 -0400
|
|
Subject: [PATCH] Use a Queue for Queueing Commands
|
|
|
|
Lists are bad as Queues mmmkay.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 5080c8296112aa093ca5450cad1d54c447ed8214..417c8bf97c5f5b7d127ac7d496b86882d75ff354 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -75,7 +75,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
|
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
|
|
@Nullable
|
|
private QueryThreadGs4 queryThreadGs4;
|
|
// private final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field
|
|
@@ -418,12 +418,14 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
}
|
|
|
|
public void handleConsoleInput(String command, CommandSourceStack commandSource) {
|
|
- 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
|
|
|
|
// CraftBukkit start - ServerCommand for preprocessing
|
|
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.msg);
|