mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
Improve ChunkMapDistance.b crash fix to clean up properly
There is some vanilla level bug where this tracking state appears to get messed up and player doesn't exists in chunk its trying to untrack. We returned early to prevent crashing, but I suspect if there was a level being tracked for the chunk, it got leaked due to the early return. So going to ensure we clean up the level tracker when this state occurs. This may help with any leaked chunk issues.
This commit is contained in:
parent
2c4499b71c
commit
146b99080c
@ -7,14 +7,17 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from
|
||||
I suspect it deals with teleporting as it uses players current x/y/z
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
index 83da76fdc495225b563cecbdb71422aec2b534f3..4e0ea454f00c69f03023f01c1d4bd2eda5553a02 100644
|
||||
index 83da76fdc495225b563cecbdb71422aec2b534f3..10e385eb556faff954df28ed0b3ddaceac2b8baa 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
@@ -237,6 +237,7 @@ public abstract class ChunkMapDistance {
|
||||
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
|
||||
@@ -238,8 +238,8 @@ public abstract class ChunkMapDistance {
|
||||
long i = sectionposition.u().pair();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
|
||||
+ if (objectset == null) return; // Paper - mitigate weird state mismatch that this chunk isn't tracked.
|
||||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
- objectset.remove(entityplayer);
|
||||
- if (objectset.isEmpty()) {
|
||||
+ if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully.
|
||||
+ if (objectset == null || objectset.isEmpty()) { // Paper
|
||||
this.c.remove(i);
|
||||
this.f.b(i, Integer.MAX_VALUE, false);
|
||||
this.g.b(i, Integer.MAX_VALUE, false);
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Optimize isOutsideRange to use distance maps
|
||||
Use a distance map to find the players in range quickly
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
index 4e0ea454f00c69f03023f01c1d4bd2eda5553a02..353b186060b2c0417a49ab3865ea5972c859b016 100644
|
||||
index 10e385eb556faff954df28ed0b3ddaceac2b8baa..ae27942991eeaec77f72b58ab32260a35f86b4a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
@@ -31,7 +31,7 @@ public abstract class ChunkMapDistance {
|
||||
@ -45,16 +45,16 @@ index 4e0ea454f00c69f03023f01c1d4bd2eda5553a02..353b186060b2c0417a49ab3865ea5972
|
||||
this.g.b(i, 0, true);
|
||||
}
|
||||
|
||||
@@ -242,7 +244,7 @@ public abstract class ChunkMapDistance {
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -241,7 +243,7 @@ public abstract class ChunkMapDistance {
|
||||
if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully.
|
||||
if (objectset == null || objectset.isEmpty()) { // Paper
|
||||
this.c.remove(i);
|
||||
- this.f.b(i, Integer.MAX_VALUE, false);
|
||||
+ //this.f.b(i, Integer.MAX_VALUE, false); // Paper - no longer used
|
||||
this.g.b(i, Integer.MAX_VALUE, false);
|
||||
}
|
||||
|
||||
@@ -266,13 +268,17 @@ public abstract class ChunkMapDistance {
|
||||
@@ -265,13 +267,17 @@ public abstract class ChunkMapDistance {
|
||||
}
|
||||
|
||||
public int b() {
|
||||
|
@ -93,10 +93,10 @@ index cf86ce24e12068d6ff7ae43cb1fd6fe665c24932..c80a55ee53eac128c94d74b78c564185
|
||||
|
||||
public final boolean isAnyNeighborsLoaded() {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
index 353b186060b2c0417a49ab3865ea5972c859b016..586a20fe5c77c2ad5fa26f337a94a16e21d8b5e2 100644
|
||||
index ae27942991eeaec77f72b58ab32260a35f86b4a4..7702fbefa598bce7e6a2d287f7ec36b78a62bff8 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
@@ -263,7 +263,7 @@ public abstract class ChunkMapDistance {
|
||||
@@ -262,7 +262,7 @@ public abstract class ChunkMapDistance {
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ index 353b186060b2c0417a49ab3865ea5972c859b016..586a20fe5c77c2ad5fa26f337a94a16e
|
||||
this.g.a(i);
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public abstract class ChunkMapDistance {
|
||||
@@ -381,7 +381,7 @@ public abstract class ChunkMapDistance {
|
||||
|
||||
private void a(long i, int j, boolean flag, boolean flag1) {
|
||||
if (flag != flag1) {
|
||||
|
Loading…
Reference in New Issue
Block a user