Skip to content

Commit a20ed38

Browse files
authored
Merge branch 'ver/26.1.2' into fix-non-persistent-enderchest-rows
2 parents 4d4a787 + d4d8f4b commit a20ed38

24 files changed

Lines changed: 105 additions & 108 deletions

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ group = org.purpurmc.purpur
33
mcVersion = 26.1.2
44
apiVersion = 26.1.2
55
channel=EXPERIMENTAL
6-
paperCommit = 3611a815e6b331199f8e6edd594d62c0cb995aee
6+
paperCommit = 7799bf28ae9ba1cbf3b9a23f10f79df5c8e832bc
77

88
org.gradle.configuration-cache = true
99
org.gradle.caching = true

purpur-api/paper-patches/files/src/main/java/org/bukkit/Bukkit.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/src/main/java/org/bukkit/Bukkit.java
22
+++ b/src/main/java/org/bukkit/Bukkit.java
3-
@@ -3003,4 +_,147 @@
3+
@@ -3006,4 +_,147 @@
44
public static void restart() {
55
server.restart();
66
}

purpur-api/paper-patches/files/src/main/java/org/bukkit/World.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/src/main/java/org/bukkit/World.java
22
+++ b/src/main/java/org/bukkit/World.java
3-
@@ -4469,6 +_,100 @@
3+
@@ -4537,6 +_,100 @@
44
@Nullable
55
public DragonBattle getEnderDragonBattle();
66

purpur-server/minecraft-patches/features/0001-Ridables.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ index 64a82b414afd093c010878c150592c681665b735..1db70e2397137158c3df9603ea90743e
1818
public boolean isClientAuthoritative() {
1919
return false;
2020
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
21-
index 9589fc0621021f900ed62f929b7da69705c91573..0279b1d6456ec271b1fc706a9fb5608de179c383 100644
21+
index 33915dbc64062bbe8d0d9df6dbdb60660c1ad9c6..07d3c51b80c251da74aba87bdbf9ac74650b83e5 100644
2222
--- a/net/minecraft/server/MinecraftServer.java
2323
+++ b/net/minecraft/server/MinecraftServer.java
24-
@@ -1862,6 +1862,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
24+
@@ -1876,6 +1876,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2525
for (ServerLevel level : this.getAllLevels()) {
2626
level.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
2727
level.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
@@ -30,10 +30,10 @@ index 9589fc0621021f900ed62f929b7da69705c91573..0279b1d6456ec271b1fc706a9fb5608d
3030
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = level.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
3131
profiler.push(() -> level + " " + level.dimension().identifier());
3232
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
33-
index 3710e3ff7a65058dd4799459400a5be6bcf19cb8..7898b28dc2ccca20800d989334b625e8a95c935c 100644
33+
index aa1282fbd44533cbc563fff74d8a1c309f1a9cc0..1072da2fa0138d42769749cc98c6ec0f97fd6f09 100644
3434
--- a/net/minecraft/server/level/ServerLevel.java
3535
+++ b/net/minecraft/server/level/ServerLevel.java
36-
@@ -235,6 +235,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
36+
@@ -236,6 +236,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
3737
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
3838
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
3939
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
@@ -62,10 +62,10 @@ index 3e8a8509c0574e732c8054cc2b86f74dd47d29d4..1bd1bb805060604fbe4dca6d71a863bb
6262

6363
private void updatePlayerAttributes() {
6464
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
65-
index ae965a1c6663ea9dd9588f010cd7831b51357fb0..8ec1aa8fdd2745d2269d73a9cfbb5f489408b91d 100644
65+
index abf5fc6b4beed0e3148c319cfa626be9f25d6b09..0069b240b1be6b80a979bfa9784fb4fd634e7440 100644
6666
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
6767
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
68-
@@ -3008,6 +3008,8 @@ public class ServerGamePacketListenerImpl
68+
@@ -3000,6 +3000,8 @@ public class ServerGamePacketListenerImpl
6969
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
7070
final boolean resendData = event.isCancelled() || !ServerGamePacketListenerImpl.this.player.getItemInHand(hand).is(itemType);
7171

@@ -75,7 +75,7 @@ index ae965a1c6663ea9dd9588f010cd7831b51357fb0..8ec1aa8fdd2745d2269d73a9cfbb5f48
7575
if (itemType == Items.WATER_BUCKET && target instanceof net.minecraft.world.entity.animal.Bucketable && target instanceof LivingEntity && resendData) {
7676
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
7777
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
78-
index dd99157af3e234b0c2b3a74e964583dea2e5ba36..1ff07b2d360e42a073a6ff0f2a188f320f8376b3 100644
78+
index 1922a09d57f7f91ef2dec814918fd9da4a9189cd..49c5c8ab8f3333d4d6a96643e7018905a533b645 100644
7979
--- a/net/minecraft/world/entity/Entity.java
8080
+++ b/net/minecraft/world/entity/Entity.java
8181
@@ -3396,6 +3396,13 @@ public abstract class Entity
@@ -107,7 +107,7 @@ index dd99157af3e234b0c2b3a74e964583dea2e5ba36..1ff07b2d360e42a073a6ff0f2a188f32
107107
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
108108
this.passengers = ImmutableList.of();
109109
} else {
110-
@@ -5418,4 +5433,44 @@ public abstract class Entity
110+
@@ -5417,4 +5432,44 @@ public abstract class Entity
111111
return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition());
112112
}
113113
// Paper end - Expose entity id counter
@@ -1814,7 +1814,7 @@ index 3d4bfeae2fddb9ace26e7dea8870704d8309862b..ed8fa3aa3d0bb3c83f46a902dfe60394
18141814
profiler.pop();
18151815
profiler.push("tadpoleActivityUpdate");
18161816
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
1817-
index 6c637f9fb552bc287cdddf976b472bae3915b7b4..d4353bb9ba2168b81726bfaa406175e7f2af601a 100644
1817+
index 3cb1e55e5400c4ab78fd10fc76db38e8d0dac1a0..3116825b324091b0fd769c7293c5514d88cc3cb5 100644
18181818
--- a/net/minecraft/world/entity/animal/goat/Goat.java
18191819
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
18201820
@@ -100,6 +100,23 @@ public class Goat extends Animal {
@@ -2027,7 +2027,7 @@ index 0993ec37f58cbc6b201ebc9aeb39aee438bd1cf9..6875e40687bbde6aba25da7d3145eccd
20272027
}
20282028

20292029
diff --git a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
2030-
index 413df81578393382a2e6a3aac370d5545d32bd11..f1da6beccfd658d8209dbc3e52f570a476f1c95b 100644
2030+
index a7a9deaf637c2e994940ee8fdad7e5e09464dabe..d7f7bafb7c7854ce6bf64bbbab022fdb85a2e9d7 100644
20312031
--- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
20322032
+++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
20332033
@@ -134,6 +134,13 @@ public class HappyGhast extends Animal {

purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Barrels and enderchests 6 rows
55

66

77
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
8-
index 962dcadc6615128c2ac28e198955aedec09c9317..1d7a67ce5c33119c4ae794f61a5639a92a9e9dd1 100644
8+
index 7c0382f7cb42f448e947001542b7f40f11b018e9..341021c3952b89b6e234ce777aa37856eea58ff8 100644
99
--- a/net/minecraft/server/players/PlayerList.java
1010
+++ b/net/minecraft/server/players/PlayerList.java
11-
@@ -889,6 +889,27 @@ public abstract class PlayerList {
11+
@@ -888,6 +888,27 @@ public abstract class PlayerList {
1212
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
1313
this.server.getCommands().sendCommands(player);
1414
} // Paper - Add sendOpLevel API

purpur-server/minecraft-patches/features/0020-Setting-to-reintroduce-end-void-rings.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Setting to reintroduce end void rings
55

66

77
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
8-
index 0279b1d6456ec271b1fc706a9fb5608de179c383..a653755f70f5f37b60bdd71f0ef51632cfc00186 100644
8+
index 07d3c51b80c251da74aba87bdbf9ac74650b83e5..761acf1c9cae98fc8d7699685824f561352a8f66 100644
99
--- a/net/minecraft/server/MinecraftServer.java
1010
+++ b/net/minecraft/server/MinecraftServer.java
11-
@@ -1351,6 +1351,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
11+
@@ -1361,6 +1361,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1212
}
1313
}
1414
// Purpur end - config for startup commands

purpur-server/minecraft-patches/sources/net/minecraft/network/Connection.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/net/minecraft/network/Connection.java
22
+++ b/net/minecraft/network/Connection.java
3-
@@ -552,11 +_,20 @@
3+
@@ -554,11 +_,20 @@
44
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
55
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
66
private static int currTick; // Paper - Buffer joins to world

purpur-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
getTPS(this.tickTimes1m, interval),
2626
getTPS(this.tickTimes5m, interval),
2727
getTPS(this.tickTimes15m, interval)
28-
@@ -1047,6 +_,15 @@
28+
@@ -1057,6 +_,15 @@
2929

3030
LOGGER.info("Stopping server");
3131
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -41,7 +41,7 @@
4141
// CraftBukkit start
4242
if (this.server != null) {
4343
this.server.spark.disable(); // Paper - spark
44-
@@ -1141,6 +_,8 @@
44+
@@ -1151,6 +_,8 @@
4545
this.safeShutdown(wait, false);
4646
}
4747
public void safeShutdown(final boolean wait, final boolean isRestarting) {
@@ -50,7 +50,7 @@
5050
this.isRestarting = isRestarting;
5151
this.hasLoggedStop = true; // Paper - Debugging
5252
if (this.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
53-
@@ -1322,11 +_,21 @@
53+
@@ -1332,11 +_,21 @@
5454
}
5555
// Paper end - Add onboarding message for initial server start
5656
// Paper start - Improve outdated version checking
@@ -73,7 +73,7 @@
7373
while (this.running) {
7474
final long tickStart = System.nanoTime(); // Paper - improve tick loop
7575
long thisTickNanos; // Paper - improve tick loop - diff on change, expect this to be tick interval
76-
@@ -1340,9 +_,11 @@
76+
@@ -1350,9 +_,11 @@
7777
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(thisTickNanos, tickStart));
7878
final long catchup = (long)Math.max(
7979
1,
@@ -86,7 +86,7 @@
8686
// adjust ticksBehind so that it is not greater-than catchup
8787
if (ticksBehind - catchup > 0L) {
8888
final long difference = ticksBehind - catchup;
89-
@@ -1965,7 +_,7 @@
89+
@@ -1983,7 +_,7 @@
9090
}
9191

9292
public String getServerModName() {

purpur-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
1010

1111
// CraftBukkit start
12-
@@ -642,8 +_,25 @@
12+
@@ -643,8 +_,25 @@
1313
// CraftBukkit end
1414
this.tickTime = tickTime;
1515
this.server = server;
@@ -35,25 +35,25 @@
3535
+ // Purpur end - Allow toggling special MobSpawners per world
3636
ChunkGenerator generator = levelStem.generator();
3737
// CraftBukkit start
38-
if (loadedWorldData.pdc() != null) {
39-
@@ -731,6 +_,7 @@
38+
// Paper start - per-world time
39+
@@ -738,6 +_,7 @@
4040
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
4141
// Paper end - rewrite chunk system
4242
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
4343
+ this.preciseTime = this.serverLevelData.getGameTime(); // Purpur - Configurable daylight cycle
4444
}
4545

4646
// Paper start
47-
@@ -787,7 +_,7 @@
47+
@@ -794,7 +_,7 @@
4848
}
4949

5050
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
5151
- if (this.sleepStatus.areEnoughSleeping(percentage) && this.sleepStatus.areEnoughDeepSleeping(percentage, this.players)) {
5252
+ if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(percentage) && this.sleepStatus.areEnoughDeepSleeping(percentage, this.players)) { // Purpur - Config for skipping night
5353
Optional<Holder<WorldClock>> defaultClock = this.dimensionType().defaultClock();
54-
org.bukkit.event.world.TimeSkipEvent event = null; // Paper - time skip event
54+
org.bukkit.event.world.ClockTimeSkipEvent event = null; // Paper - per-world time
5555
if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) {
56-
@@ -1026,9 +_,18 @@
56+
@@ -1036,9 +_,18 @@
5757
&& this.random.nextDouble() < difficulty.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
5858
&& !this.getBlockState(pos.below()).is(BlockTags.LIGHTNING_RODS);
5959
if (isTrap) {
@@ -73,7 +73,7 @@
7373
horse.setAge(0);
7474
horse.setPos(pos.getX(), pos.getY(), pos.getZ());
7575
this.addFreshEntity(horse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
76-
@@ -1063,9 +_,35 @@
76+
@@ -1073,9 +_,35 @@
7777
if (state.is(Blocks.SNOW)) {
7878
int currentLayers = state.getValue(SnowLayerBlock.LAYERS);
7979
if (currentLayers < Math.min(maxHeight, 8)) {
@@ -109,7 +109,7 @@
109109
}
110110
} else {
111111
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, topPos, Blocks.SNOW.defaultBlockState(), Block.UPDATE_ALL, null); // CraftBukkit
112-
@@ -1086,7 +_,7 @@
112+
@@ -1096,7 +_,7 @@
113113
p -> p.is(PoiTypes.LIGHTNING_ROD),
114114
lightningRodPos -> lightningRodPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, lightningRodPos.getX(), lightningRodPos.getZ()) - 1,
115115
center,
@@ -118,7 +118,7 @@
118118
PoiManager.Occupancy.ANY
119119
);
120120
return nearbyLightningRod.map(blockPos -> blockPos.above(1));
121-
@@ -1134,8 +_,26 @@
121+
@@ -1144,8 +_,26 @@
122122
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
123123
Component message;
124124
if (this.sleepStatus.areEnoughSleeping(percentage)) {
@@ -145,23 +145,23 @@
145145
message = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(percentage));
146146
}
147147

148-
@@ -1301,6 +_,7 @@
148+
@@ -1311,6 +_,7 @@
149149
public void resetWeatherCycle() {
150150
WeatherData weatherData = this.getWeatherData();
151151
// CraftBukkit start
152152
+ if (this.purpurConfig.rainStopsAfterSleep) // Purpur - Option for if rain and thunder should stop on sleep
153153
weatherData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
154154
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
155155
// Not that everyone ever manages to get the whole server to sleep at the same time....
156-
@@ -1308,6 +_,7 @@
156+
@@ -1318,6 +_,7 @@
157157
weatherData.setRainTime(0);
158158
}
159159
// CraftBukkit end
160160
+ if (this.purpurConfig.thunderStopsAfterSleep) // Purpur - Option for if rain and thunder should stop on sleep
161161
weatherData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
162162
// CraftBukkit start
163163
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
164-
@@ -1979,7 +_,7 @@
164+
@@ -1989,7 +_,7 @@
165165
Explosion.BlockInteraction blockInteraction = switch (interactionType) {
166166
case NONE -> Explosion.BlockInteraction.KEEP;
167167
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
@@ -170,7 +170,7 @@
170170
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
171171
: Explosion.BlockInteraction.KEEP;
172172
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
173-
@@ -2909,7 +_,7 @@
173+
@@ -2919,7 +_,7 @@
174174
// Spigot start
175175
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
176176
// Paper start - Fix merchant inventory not closing on entity removal

purpur-server/minecraft-patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
private volatile int latency; // Paper - improve keepalives - make volatile
1414
private final io.papermc.paper.util.KeepAlive keepAlive; // Paper - improve keepalives
1515
private volatile boolean suspendFlushingOnServerThread = false;
16-
@@ -54,6 +_,10 @@
16+
@@ -53,6 +_,10 @@
1717
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
1818
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
1919
protected static final net.minecraft.resources.Identifier MINECRAFT_BRAND = net.minecraft.resources.Identifier.withDefaultNamespace("brand"); // Paper - Brand support
@@ -24,7 +24,7 @@
2424
// Paper start - retain certain values
2525
public @Nullable String playerBrand;
2626
public final java.util.Set<String> pluginMessagerChannels;
27-
@@ -105,6 +_,18 @@
27+
@@ -104,6 +_,18 @@
2828
// Paper start - improve keepalives
2929
long now = System.nanoTime();
3030
io.papermc.paper.util.KeepAlive.PendingKeepAlive pending = this.keepAlive.pendingKeepAlives.peek();
@@ -43,7 +43,7 @@
4343
if (pending != null && pending.challengeId() == packet.getId()) {
4444
this.keepAlive.pendingKeepAlives.remove(pending);
4545

46-
@@ -179,6 +_,12 @@
46+
@@ -172,6 +_,12 @@
4747
return;
4848
}
4949

@@ -56,17 +56,17 @@
5656
if (identifier.equals(MINECRAFT_BRAND)) {
5757
this.playerBrand = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
5858
}
59-
@@ -264,6 +_,23 @@
59+
@@ -257,6 +_,23 @@
6060
Profiler.get().push("keepAlive");
6161
long now = Util.getMillis();
6262
// Paper start - improve keepalives
6363
+ // Purpur start - Alternative Keepalive Handling
6464
+ if (org.purpurmc.purpur.PurpurConfig.useAlternateKeepAlive) {
65-
+ if (this.checkIfClosed(now) && !this.processedDisconnect) {
65+
+ if (this.checkIfClosed(now)) {
6666
+ long currTime = System.nanoTime();
6767
+ if ((currTime - this.keepAlive.lastKeepAliveTx) >= java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)) { // 1 second
6868
+ this.keepAlive.lastKeepAliveTx = currTime;
69-
+ if (this.keepAlivePending && !this.processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
69+
+ if (this.keepAlivePending && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
7070
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, io.papermc.paper.connection.DisconnectionReason.TIMEOUT);
7171
+ } else if (this.checkIfClosed(now)) {
7272
+ this.keepAlivePending = true;
@@ -77,6 +77,6 @@
7777
+ }
7878
+ } else
7979
+ // Purpur end - Alternative Keepalive Handling
80-
if (this.checkIfClosed(now) && !this.processedDisconnect) {
80+
if (this.checkIfClosed(now)) {
8181
long currTime = System.nanoTime();
8282

0 commit comments

Comments
 (0)