diff --git a/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch b/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch index 986cbe521b62..a52a7d889875 100644 --- a/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch +++ b/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch @@ -23059,7 +23059,7 @@ index cda915fcb4822689f42b25280eb99aee082ddb74..094d2d528cb74b8f1d277cd780bba7f4 thread1 -> { DedicatedServer dedicatedServer1 = new DedicatedServer( diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03b123ef3c 100644 +index acf2ccbaea192ea36fc5a8e034c9fe035114a3cb..6120274911eb321b24300e077151a1e264412725 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java @@ -185,7 +185,7 @@ import net.minecraft.world.scores.ScoreboardSaveData; @@ -23071,7 +23071,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03 private static MinecraftServer SERVER; // Paper public static final Logger LOGGER = LogUtils.getLogger(); public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper -@@ -397,6 +397,93 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop false : this::haveTime); @@ -23302,7 +23302,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03 this.tickFrame.end(); this.recordEndOfTick(); // Paper - improve tick loop profilerFiller.pop(); -@@ -2562,6 +2681,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { diff --git a/paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch b/paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch index 81e59ebe1a17..a276ab4cfc6d 100644 --- a/paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch +++ b/paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Incremental chunk and player saving diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 8dc6adb868ade00fdee6f3f53aff01fddf79926d..7e8715af6433ac3324ae7d79f5252a4550af6bb1 100644 +index 0e8d05f167e4ca0d9cc26f2015d1064940cef22a..2cd167bf7b6b2a628926d14e58441573e02b111d 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -972,7 +972,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - BlockPhysicsEvent serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent serverLevel.updateLagCompensationTick(); // Paper - lag compensation diff --git a/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch b/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch index dfe4e32943b8..e1efceda11c8 100644 --- a/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch +++ b/paper-server/patches/sources/net/minecraft/commands/Commands.java.patch @@ -8,15 +8,30 @@ public static final String COMMAND_PREFIX = "/"; private static final ThreadLocal<@Nullable ExecutionContext> CURRENT_EXECUTION_CONTEXT = new ThreadLocal<>(); private static final Logger LOGGER = LogUtils.getLogger(); -@@ -179,6 +_,7 @@ +@@ -164,7 +_,7 @@ + public static final PermissionCheck LEVEL_ADMINS = new PermissionCheck.Require(Permissions.COMMANDS_ADMIN); + public static final PermissionCheck LEVEL_OWNERS = new PermissionCheck.Require(Permissions.COMMANDS_OWNER); + private static final ClientboundCommandsPacket.NodeInspector COMMAND_NODE_INSPECTOR = new ClientboundCommandsPacket.NodeInspector() { +- private final CommandSourceStack noPermissionSource = Commands.createCompilationContext(PermissionSet.NO_PERMISSIONS); ++ private final CommandSourceStack noPermissionSource = Commands.createCompilationContext(PermissionSet.NO_PERMISSIONS); // Paper - diff on change - don't violate API contracts for location nullability + + @Override + public @Nullable Identifier suggestionId(ArgumentCommandNode node) { +@@ -179,13 +_,25 @@ @Override public boolean isRestricted(CommandNode node) { + if (node.getRequirement() instanceof RestrictedMarker) return true; // Paper - restricted api Predicate requirement = node.getRequirement(); ++ // Paper start - don't violate API contracts for location nullability ++ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); ++ if (server != null) { ++ return !requirement.test(server.getOrCreateNoPermissionsCommandSourceStack()); ++ } ++ // Paper end - don't violate API contracts for location nullability return !requirement.test(this.noPermissionSource); } -@@ -186,6 +_,11 @@ + }; private final CommandDispatcher dispatcher = new CommandDispatcher<>(); public Commands(Commands.CommandSelection selection, CommandBuildContext context) { diff --git a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch index 27b0b2653370..18955ef9bef7 100644 --- a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -40,10 +40,11 @@ private int playerIdleTimeout; private final long[] tickTimesNanos = new long[100]; private long aggregatedTickTimesNanos = 0L; -@@ -281,10 +_,109 @@ +@@ -281,10 +_,110 @@ private final DiscontinuousFrame tickFrame; private final PacketProcessor packetProcessor; ++ private @Nullable CommandSourceStack noPermissionsCommandSourceStack = null; // Paper - don't violate API contracts for location nullability + // CraftBukkit start + public final WorldLoader.DataLoadContext worldLoaderContext; + public org.bukkit.craftbukkit.CraftServer server; @@ -1136,7 +1137,7 @@ profilerFiller.popPush("connection"); this.tickConnection(); -@@ -1176,9 +_,12 @@ +@@ -1176,10 +_,14 @@ this.serverActivityMonitor.tick(); } @@ -1149,8 +1150,10 @@ + respawnData = respawnData.withLevel(serverLevel.dimension()); + // Paper end - per world respawn data - read "server global" respawn data from overworld dimension reference this.effectiveRespawnData = serverLevel.getWorldBorderAdjustedRespawnData(respawnData); ++ this.noPermissionsCommandSourceStack = null; // Paper - don't violate API contracts for location nullability } + public void tickConnection() { @@ -1228,6 +_,22 @@ return this.levels.get(dimension); } @@ -1375,6 +1378,42 @@ } } } +@@ -1718,6 +_,26 @@ + return this.resources.managers.getCommands(); + } + ++ // Paper start - don't violate API contracts for location nullability ++ public CommandSourceStack getOrCreateNoPermissionsCommandSourceStack() { ++ if (this.noPermissionsCommandSourceStack != null) { ++ return this.noPermissionsCommandSourceStack; ++ } ++ ServerLevel serverLevel = this.findRespawnDimension(); ++ this.noPermissionsCommandSourceStack = new CommandSourceStack( ++ this, ++ Vec3.atLowerCornerOf(this.getRespawnData().pos()), ++ Vec2.ZERO, ++ serverLevel, ++ PermissionSet.NO_PERMISSIONS, ++ "", ++ net.minecraft.network.chat.CommonComponents.EMPTY, ++ this, ++ null ++ ); ++ return this.noPermissionsCommandSourceStack; ++ } ++ // Paper end - don't violate API contracts for location nullability + public CommandSourceStack createCommandSourceStack() { + ServerLevel serverLevel = this.findRespawnDimension(); + return new CommandSourceStack( +@@ -1725,7 +_,7 @@ + Vec3.atLowerCornerOf(this.getRespawnData().pos()), + Vec2.ZERO, + serverLevel, +- LevelBasedPermissionSet.OWNER, ++ PermissionSet.NO_PERMISSIONS, + "Server", + Component.literal("Server"), + this, @@ -1734,12 +_,12 @@ }