Add rcon command source to dispatch check

I am surprised it does not implement ConsoleCommandSender.
This commit is contained in:
Spottedleaf 2024-01-20 19:07:29 -08:00
parent 4d78338afe
commit 27561750dd
2 changed files with 9 additions and 7 deletions

View File

@ -21809,7 +21809,7 @@ index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..f3df9c9b6cff85565514f990597f3fe5
LevelChunkTicks<T> levelChunkTicks = this.allContainers.get(l);
if (levelChunkTicks == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed..bfa318486443c61c3734046331fdfeecf9852591 100644
index d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed..d05fb79f3d34984722f8385417dc496bb97414a7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -307,7 +307,7 @@ public final class CraftServer implements Server {
@ -21844,7 +21844,7 @@ index d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed..bfa318486443c61c3734046331fdfeec
if (sender instanceof Conversable) {
Conversable conversable = (Conversable) sender;
@@ -978,12 +987,44 @@ public final class CraftServer implements Server {
@@ -978,12 +987,46 @@ public final class CraftServer implements Server {
}
}
@ -21878,7 +21878,9 @@ index d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed..bfa318486443c61c3734046331fdfeec
+ // Folia start - region threading
+ if ((sender instanceof Entity entity)) {
+ io.papermc.paper.util.TickThread.ensureTickThread(((org.bukkit.craftbukkit.entity.CraftEntity)entity).getHandle(), "Dispatching command async");
+ } else if (sender instanceof ConsoleCommandSender || sender instanceof io.papermc.paper.commands.FeedbackForwardingSender) {
+ } else if (sender instanceof ConsoleCommandSender || sender instanceof net.minecraft.server.rcon.RconConsoleSource
+ || sender instanceof org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender
+ || sender instanceof io.papermc.paper.commands.FeedbackForwardingSender) {
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Dispatching command async");
+ } else {
+ // huh?
@ -21889,7 +21891,7 @@ index d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed..bfa318486443c61c3734046331fdfeec
if (this.commandMap.dispatch(sender, commandLine)) {
return true;
}
@@ -3208,7 +3249,7 @@ public final class CraftServer implements Server {
@@ -3208,7 +3251,7 @@ public final class CraftServer implements Server {
@Override
public int getCurrentTick() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bfa318486443c61c3734046331fdfeecf9852591..7d1be59d03fa4e46295bc91943fea16bd9c7c802 100644
index d05fb79f3d34984722f8385417dc496bb97414a7..f66ab15b268712322b277bd251cd40933f862926 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1264,6 +1264,7 @@ public final class CraftServer implements Server {
@@ -1266,6 +1266,7 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
@ -16,7 +16,7 @@ index bfa318486443c61c3734046331fdfeecf9852591..7d1be59d03fa4e46295bc91943fea16b
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1443,6 +1444,7 @@ public final class CraftServer implements Server {
@@ -1445,6 +1446,7 @@ public final class CraftServer implements Server {
@Override
public boolean unloadWorld(World world, boolean save) {