mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@e0ba395d Add missing plugin ticket comparator fixes #13130 PaperMC/Paper@21b49306 Fix diff in FlowingFluid#canPassThroughWall PaperMC/Paper@dcd7847d Improve server tick loop PaperMC/Paper@a4a7461c Rebase fixups PaperMC/Paper@dc66e8cf Return Server#getTPS over minute intervals instead of seconds
This commit is contained in:
@@ -2,7 +2,7 @@ group = org.purpurmc.purpur
|
||||
version = 1.21.9-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion = 1.21.9
|
||||
paperCommit = a3f247c258c4ade42011cbc6f4e2024298e673cf
|
||||
paperCommit = dc66e8cf6bdea5983b2d4628e6f202d24b3736e4
|
||||
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.caching = true
|
||||
|
||||
@@ -18,10 +18,10 @@ index aa87e93ade4c25a575e7861fef45b70c3e4e3aeb..c92ffd8b2fe4945ccd552eb54154b7be
|
||||
public boolean isClientAuthoritative() {
|
||||
return false;
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 9dffc51f3651169e81e1617bce4562faf35c12f6..5f86c3024a857d5ec3ac39a4ef1d2a77b452c2bb 100644
|
||||
index adfe166ed59ac976f15cd7ad550f002a8e41cf07..ae9182e3588b757105e5d131ddaad25a48676dc0 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1683,6 +1683,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1775,6 +1775,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||
@@ -62,7 +62,7 @@ index 5477fd9bc0a30b0d566d982b86b737cb6392b030..8c0cdb6aaf2f546b90d7d6b0d9dfc1c0
|
||||
|
||||
private void updatePlayerAttributes() {
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 8813b9d09b0ffaf235516cada788df92a7730eaa..c643f0546613e8f4783d1e0830f7267570de7ea7 100644
|
||||
index f2765b2481305f971da5e3695f465245f398c548..ade5df8bc5ef8414f8b51d63f354d59488a58ce8 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2862,6 +2862,8 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2127,7 +2127,7 @@ index 9ad94aca22a100dddaded5833763f9acd2a0ce56..96c98f032b1b3aec32aba38244ee8b45
|
||||
protected void addAdditionalSaveData(ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
diff --git a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
||||
index f9c3a33a7c5efc30a97f1ce74b94f5e6213298fe..20d2f081fa2576ea946489d3e717b389092abaef 100644
|
||||
index 620312b916e18aeba74b05631a93ea772dd7c14a..256b1d964c3069d2dd67e0a1cabd78aed5ee339a 100644
|
||||
--- a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
||||
@@ -109,6 +109,28 @@ public class CopperGolem extends AbstractGolem implements ContainerUser, Shearab
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -291,6 +_,7 @@
|
||||
@@ -286,6 +_,7 @@
|
||||
public joptsimple.OptionSet options;
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public static int currentTick; // Paper - improve tick loop
|
||||
@@ -8,25 +8,24 @@
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
// Paper - don't store the vanilla dispatcher
|
||||
@@ -301,7 +_,7 @@
|
||||
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
- public final double[] recentTps = new double[3];
|
||||
+ public final double[] recentTps = new double[4]; // Purpur - Add 5 second tps average in /tps
|
||||
// Spigot end
|
||||
public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
|
||||
public volatile boolean abnormalExit; // Paper - Improved watchdog support
|
||||
@@ -310,6 +_,8 @@
|
||||
@@ -302,6 +_,8 @@
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
+ public boolean lagging = false; // Purpur - Lagging threshold
|
||||
+ protected boolean upnp = false; // Purpur - UPnP Port Forwarding
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
@@ -928,6 +_,15 @@
|
||||
// Paper start - improve tick loop
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
|
||||
@@ -340,6 +_,7 @@
|
||||
final long now = System.nanoTime();
|
||||
final long interval = this.tickRateManager().nanosecondsPerTick();
|
||||
return new double[] {
|
||||
+ getTPS(this.tickTimes5s, now, interval), // Purpur - Add 5 second tps average in /tps
|
||||
getTPS(this.tickTimes1m, now, interval),
|
||||
getTPS(this.tickTimes5m, now, interval),
|
||||
getTPS(this.tickTimes15m, now, interval)
|
||||
@@ -964,6 +_,15 @@
|
||||
|
||||
LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
@@ -42,7 +41,7 @@
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
@@ -1026,6 +_,8 @@
|
||||
@@ -1062,6 +_,8 @@
|
||||
this.safeShutdown(waitForShutdown, false);
|
||||
}
|
||||
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
|
||||
@@ -51,15 +50,7 @@
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper - Debugging
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
@@ -1045,6 +_,7 @@
|
||||
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
||||
private long lastTick = 0;
|
||||
private long catchupTime = 0;
|
||||
+ public final RollingAverage tps5s = new RollingAverage(5); // Purpur - Add 5 second tps average in /tps
|
||||
public final RollingAverage tps1 = new RollingAverage(60);
|
||||
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
||||
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
||||
@@ -1131,6 +_,16 @@
|
||||
@@ -1245,6 +_,16 @@
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
|
||||
@@ -74,45 +65,21 @@
|
||||
+ // Purpur end - config for startup commands
|
||||
+
|
||||
while (this.running) {
|
||||
long l;
|
||||
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
|
||||
@@ -1155,14 +_,19 @@
|
||||
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
|
||||
final long diff = currentTime - tickSection;
|
||||
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
+ tps5s.add(currentTps, diff); // Purpur - Add 5 second tps average in /tps
|
||||
tps1.add(currentTps, diff);
|
||||
tps5.add(currentTps, diff);
|
||||
tps15.add(currentTps, diff);
|
||||
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
||||
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
|
||||
@@ -1258,8 +_,10 @@
|
||||
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
|
||||
final long catchup = (long)Math.max(
|
||||
1,
|
||||
- 5 //ConfigHolder.getConfig().tickLoop.catchupTicks.getOrDefault(MoonriseConfig.TickLoop.DEFAULT_CATCHUP_TICKS).intValue()
|
||||
+ org.purpurmc.purpur.PurpurConfig.tpsCatchup ? 5 : 1 //ConfigHolder.getConfig().tickLoop.catchupTicks.getOrDefault(MoonriseConfig.TickLoop.DEFAULT_CATCHUP_TICKS).intValue() // Purpur - Configurable TPS Catchup
|
||||
);
|
||||
+
|
||||
+ lagging = getTPS()[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
||||
|
||||
// Backwards compat with bad plugins
|
||||
- this.recentTps[0] = tps1.getAverage();
|
||||
- this.recentTps[1] = tps5.getAverage();
|
||||
- this.recentTps[2] = tps15.getAverage();
|
||||
+ // Purpur start - Add 5 second tps average in /tps
|
||||
+ this.recentTps[0] = tps5s.getAverage();
|
||||
+ this.recentTps[1] = tps1.getAverage();
|
||||
+ this.recentTps[2] = tps5.getAverage();
|
||||
+ this.recentTps[3] = tps15.getAverage();
|
||||
+ // Purpur end - Add 5 second tps average in /tps
|
||||
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
||||
tickSection = currentTime;
|
||||
}
|
||||
// Paper end - further improve server tick loop
|
||||
@@ -1194,6 +_,12 @@
|
||||
profilerFiller.popPush("nextTickWait");
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
|
||||
+ // Purpur start - Configurable TPS Catchup
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
|
||||
+ this.nextTickTimeNanos = currentTime + l;
|
||||
+ this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos;
|
||||
+ }
|
||||
+ // Purpur end - Configurable TPS Catchup
|
||||
this.startMeasuringTaskExecutionTime();
|
||||
this.waitUntilNextTick();
|
||||
this.finishMeasuringTaskExecutionTime();
|
||||
@@ -1628,7 +_,7 @@
|
||||
// adjust ticksBehind so that it is not greater-than catchup
|
||||
if (ticksBehind > catchup) {
|
||||
@@ -1729,7 +_,7 @@
|
||||
long worldTime = level.getGameTime();
|
||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||
for (Player entityhuman : level.players()) {
|
||||
@@ -121,7 +88,7 @@
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
@@ -1800,7 +_,7 @@
|
||||
@@ -1901,7 +_,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN));
|
||||
FluidState fluidState1 = blockState1.getFluidState();
|
||||
if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) {
|
||||
@@ -322,6 +_,12 @@
|
||||
@@ -320,6 +_,12 @@
|
||||
}
|
||||
|
||||
protected abstract boolean canConvertToSource(ServerLevel level);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
@@ -61,6 +_,7 @@
|
||||
@@ -60,7 +_,7 @@
|
||||
Vector<String> vector = new Vector<>();
|
||||
|
||||
// Follows CraftServer#getTPS
|
||||
double[] tps = new double[] {
|
||||
+ server.tps5s.getAverage(), // Purpur - Add 5 second tps average in /tps
|
||||
server.tps1.getAverage(),
|
||||
server.tps5.getAverage(),
|
||||
server.tps15.getAverage()
|
||||
@@ -73,7 +_,7 @@
|
||||
- double[] tps = server.getTPS();
|
||||
+ double[] tps = server.getTPS(); // Purpur - diff on change
|
||||
String[] tpsAvg = new String[tps.length];
|
||||
|
||||
for ( int g = 0; g < tps.length; g++) {
|
||||
@@ -69,7 +_,7 @@
|
||||
vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
|
||||
vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
|
||||
vector.add("Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double) TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -416,6 +_,20 @@
|
||||
@@ -417,6 +_,20 @@
|
||||
this.paperPluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(this, this.commandMap, pluginManager);
|
||||
this.pluginManager.paperPluginManager = this.paperPluginManager;
|
||||
// Paper end
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
CraftRegistry.setMinecraftRegistry(console.registryAccess());
|
||||
|
||||
@@ -992,6 +_,7 @@
|
||||
@@ -993,6 +_,7 @@
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -29,7 +29,7 @@
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && world.getGameRules().getBoolean(GameRules.RULE_SPAWN_MONSTERS)); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1007,6 +_,7 @@
|
||||
@@ -1008,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1024,6 +_,7 @@
|
||||
@@ -1025,6 +_,7 @@
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
@@ -45,7 +45,7 @@
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -1482,6 +_,60 @@
|
||||
@@ -1483,6 +_,60 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
@Override
|
||||
public List<Recipe> getRecipesFor(ItemStack result) {
|
||||
Preconditions.checkArgument(result != null, "ItemStack cannot be null");
|
||||
@@ -2725,6 +_,18 @@
|
||||
@@ -2728,6 +_,18 @@
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
|
||||
@@ -125,15 +125,7 @@
|
||||
@Override
|
||||
public void restart() {
|
||||
CraftServer.this.restart();
|
||||
@@ -2757,6 +_,7 @@
|
||||
@Override
|
||||
public double[] getTPS() {
|
||||
return new double[] {
|
||||
+ net.minecraft.server.MinecraftServer.getServer().tps5s.getAverage(), // Purpur - Add 5 second tps average in /tps
|
||||
net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(),
|
||||
net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(),
|
||||
net.minecraft.server.MinecraftServer.getServer().tps15.getAverage()
|
||||
@@ -2964,4 +_,18 @@
|
||||
@@ -2963,4 +_,18 @@
|
||||
public void allowPausing(final Plugin plugin, final boolean value) {
|
||||
this.console.addPluginAllowingSleep(plugin.getName(), value);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
@@ -43,7 +_,7 @@
|
||||
@@ -47,7 +_,7 @@
|
||||
}
|
||||
|
||||
TextComponent.Builder builder = text();
|
||||
|
||||
Reference in New Issue
Block a user