Fix incremental player saving check

This commit is contained in:
Nassim Jahnke 2021-11-25 12:49:24 +01:00 committed by MiniDigger | Martin
parent 5a90a2033d
commit 4e60e11b6b

View File

@ -90,7 +90,7 @@ index 84f78e2b3bf51eae1d486852464df032861c5a0b..968b8180f92066a43f06bff8dd1d49b0
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 310bed27c04ef812aa8607c9dca789db13341d25..b1f93551ce3e4d12e5cbe424c1ceaf3da20d0ffd 100644
index 310bed27c04ef812aa8607c9dca789db13341d25..2cd1dace84b6e821df69d28aa7cdb7ff41c8f076 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,7 @@ public abstract class PlayerList {
@ -116,7 +116,7 @@ index 310bed27c04ef812aa8607c9dca789db13341d25..b1f93551ce3e4d12e5cbe424c1ceaf3d
for (int i = 0; i < this.players.size(); ++i) {
- this.save(this.players.get(i));
+ ServerPlayer entityplayer = this.players.get(i);
+ if (interval != -1 || now - entityplayer.lastSave >= interval) {
+ if (interval == -1 || now - entityplayer.lastSave >= interval) {
+ this.save(entityplayer);
+ if (interval != -1 && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; }
+ }