mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 14:51:27 +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
3028a91f26
commit
bfe5d554d3
@ -11,10 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
|
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
|
||||||
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
|
|
||||||
long i = sectionposition.u().pair();
|
long i = sectionposition.u().pair();
|
||||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
|
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);
|
- objectset.remove(entityplayer);
|
||||||
if (objectset.isEmpty()) {
|
- 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);
|
||||||
|
@ -46,8 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
|
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
|
||||||
objectset.remove(entityplayer);
|
if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully.
|
||||||
if (objectset.isEmpty()) {
|
if (objectset == null || objectset.isEmpty()) { // Paper
|
||||||
this.c.remove(i);
|
this.c.remove(i);
|
||||||
- this.f.b(i, Integer.MAX_VALUE, false);
|
- this.f.b(i, Integer.MAX_VALUE, false);
|
||||||
+ //this.f.b(i, Integer.MAX_VALUE, false); // Paper - no longer used
|
+ //this.f.b(i, Integer.MAX_VALUE, false); // Paper - no longer used
|
||||||
|
Loading…
Reference in New Issue
Block a user