Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
72e87abc2d
Co-authored-by: Paul Sauve <paul@technove.co>
40 Zeilen
2.2 KiB
Diff
40 Zeilen
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 980088f5af3d44d47b94ecde52cdc5f9277f6329..ff908bab7d83e5c049d86a0c8ea235ca3c69936b 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -69,7 +69,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 - use a proper queuemmands
|
|
@Nullable
|
|
private QueryThreadGs4 queryThreadGs4;
|
|
// public final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field
|
|
@@ -439,13 +439,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
return;
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
- this.consoleInput.add(new ConsoleInput(command, commandSource));
|
|
+ this.serverCommandQueue.add(new ConsoleInput(command, commandSource)); // Paper - use proper queue
|
|
}
|
|
|
|
public void handleConsoleInputs() {
|
|
MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
|
|
- while (!this.consoleInput.isEmpty()) {
|
|
- ConsoleInput servercommand = (ConsoleInput) this.consoleInput.remove(0);
|
|
+ // Paper start - use proper queue
|
|
+ ConsoleInput servercommand;
|
|
+ while ((servercommand = this.serverCommandQueue.poll()) != null) {
|
|
+ // Paper end
|
|
|
|
// CraftBukkit start - ServerCommand for preprocessing
|
|
ServerCommandEvent event = new ServerCommandEvent(console, servercommand.msg);
|