mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-04 08:52:01 -05:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5146cf654 | ||
|
|
db31c35c53 | ||
|
|
f191496685 |
No files matched your search
@@ -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<TickTa
|
||||
@@ -398,6 +398,93 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return minecraftServer;
|
||||
}
|
||||
|
||||
@@ -23165,7 +23165,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
public MinecraftServer(
|
||||
// CraftBukkit start
|
||||
joptsimple.OptionSet options,
|
||||
@@ -825,7 +912,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -826,7 +913,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
serverLevel.setSpawnSettings(serverLevel.isSpawningMonsters()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
this.updateEffectiveRespawnData();
|
||||
this.forceTicks = false; // CraftBukkit
|
||||
@@ -23174,7 +23174,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
new org.bukkit.event.world.WorldLoadEvent(serverLevel.getWorld()).callEvent(); // Paper - call WorldLoadEvent
|
||||
}
|
||||
|
||||
@@ -848,6 +935,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -849,6 +936,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public abstract boolean shouldRconBroadcast();
|
||||
|
||||
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
|
||||
@@ -23186,7 +23186,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
if (this.overworld() != null) this.scoreboard.storeToSaveDataIfDirty(this.overworld().getDataStorage().computeIfAbsent(ScoreboardSaveData.TYPE)); // Paper - don't try to save if the overworld was not loaded, generally during early startup failures
|
||||
boolean flag = false;
|
||||
|
||||
@@ -856,7 +948,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -857,7 +949,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("Saving chunks for level '{}'/{}", serverLevel, serverLevel.dimension().identifier());
|
||||
}
|
||||
|
||||
@@ -23195,7 +23195,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -946,7 +1038,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -947,7 +1039,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23204,7 +23204,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
|
||||
|
||||
for (ServerLevel serverLevelx : this.getAllLevels()) {
|
||||
@@ -956,18 +1048,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -957,18 +1049,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.waitUntilNextTick();
|
||||
}
|
||||
@@ -23230,7 +23230,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
|
||||
this.isSaving = false;
|
||||
this.resources.close();
|
||||
@@ -987,6 +1075,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -988,6 +1076,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.services().nameToIdCache().save(false); // Paper - Perf: Async GameProfileCache saving
|
||||
}
|
||||
// Spigot end
|
||||
@@ -23245,7 +23245,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
// Paper start - Improved watchdog support - move final shutdown items here
|
||||
Util.shutdownExecutors();
|
||||
try {
|
||||
@@ -1081,16 +1177,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1082,16 +1178,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// execute small amounts of other tasks just in case the number of tasks we are
|
||||
// draining is large - chunk system and packet processing may be latency sensitive
|
||||
|
||||
@@ -23280,7 +23280,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
profiler.pop(); // moonrise:run_all_chunk
|
||||
profiler.pop(); // moonrise:run_all_tasks
|
||||
|
||||
@@ -1396,6 +1507,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1397,6 +1508,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
private boolean pollTaskInternal() {
|
||||
if (super.pollTask()) {
|
||||
@@ -23288,7 +23288,7 @@ index 330d1f751006e6a5acfec1a3ab390b1c2d482299..af7e9692a38f8278734e2f1ab51c1e03
|
||||
return true;
|
||||
} else {
|
||||
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
|
||||
@@ -1537,6 +1649,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1538,6 +1650,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper - improve tick loop - moved into runAllTasksAtTickStart
|
||||
this.runAllTasksAtTickStart(); // Paper - improve tick loop
|
||||
this.tickServer(sprinting ? () -> 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<TickTa
|
||||
@@ -2584,6 +2703,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33362,10 +33362,10 @@ index c9bbf15b75ac4516c7d7fdfaf2390351702ca415..372030b78d25b4ff0b18575d151b0a63
|
||||
return structureTemplate.save(new CompoundTag());
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index df34832f5f35376a77aaecd802c70fa093e0d539..3cb08ede3a46ac6f54d301a1ea01f3960dcd0c0d 100644
|
||||
index 6120274911eb321b24300e077151a1e264412725..0e8d05f167e4ca0d9cc26f2015d1064940cef22a 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -383,6 +383,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -384,6 +384,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - improve tick loop
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
|
||||
|
||||
@@ -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<TickTa
|
||||
@@ -973,7 +973,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
boolean var4;
|
||||
try {
|
||||
this.isSaving = true;
|
||||
@@ -17,7 +17,7 @@ index 8dc6adb868ade00fdee6f3f53aff01fddf79926d..7e8715af6433ac3324ae7d79f5252a45
|
||||
var4 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
@@ -1620,9 +1620,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1621,9 +1621,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
this.ticksUntilAutosave--;
|
||||
|
||||
@@ -20,10 +20,10 @@ index 2bc436cdf5180a7943c45fabb9fbbedae6f7db56..f312a7f5b1b2a777ab36b94ce7cbf387
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 7e8715af6433ac3324ae7d79f5252a4550af6bb1..092ead4419f0a558f25b4baacf3343b05c872022 100644
|
||||
index 2cd167bf7b6b2a628926d14e58441573e02b111d..2352b715153272e823226529778016ef42d31b26 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1753,33 +1753,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1754,33 +1754,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..24a2090e068ad3c0d08705050944abdf
|
||||
+ }
|
||||
+}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 092ead4419f0a558f25b4baacf3343b05c872022..c2227d57ea2e2da537a313d4bfd2f8c7f776be64 100644
|
||||
index 2352b715153272e823226529778016ef42d31b26..afba7093daba7cf322a448e61fdaf208d591daa0 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1808,6 +1808,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1809,6 +1809,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
serverLevel.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
||||
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
||||
|
||||
@@ -8,15 +8,30 @@
|
||||
public static final String COMMAND_PREFIX = "/";
|
||||
private static final ThreadLocal<@Nullable ExecutionContext<CommandSourceStack>> 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<CommandSourceStack> COMMAND_NODE_INSPECTOR = new ClientboundCommandsPacket.NodeInspector<CommandSourceStack>() {
|
||||
- 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<CommandSourceStack, ?> node) {
|
||||
@@ -179,13 +_,25 @@
|
||||
|
||||
@Override
|
||||
public boolean isRestricted(CommandNode<CommandSourceStack> node) {
|
||||
+ if (node.getRequirement() instanceof RestrictedMarker) return true; // Paper - restricted api
|
||||
Predicate<CommandSourceStack> 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<CommandSourceStack> dispatcher = new CommandDispatcher<>();
|
||||
|
||||
public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
|
||||
|
||||
@@ -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 @@
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user