mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Remove cb null check
This commit is contained in:
parent
df778ff55d
commit
e99a9b5e4a
2 changed files with 12 additions and 9 deletions
|
@ -78,15 +78,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private SortedArraySet<Ticket<?>> getTickets(long chunkPos) {
|
private SortedArraySet<Ticket<?>> getTickets(long chunkPos) {
|
||||||
@@ -217,8 +_,9 @@
|
@@ -217,8 +_,12 @@
|
||||||
ChunkPos chunkPos = sectionPos.chunk();
|
ChunkPos chunkPos = sectionPos.chunk();
|
||||||
long packedChunkPos = chunkPos.toLong();
|
long packedChunkPos = chunkPos.toLong();
|
||||||
ObjectSet<ServerPlayer> set = this.playersPerChunk.get(packedChunkPos);
|
ObjectSet<ServerPlayer> set = this.playersPerChunk.get(packedChunkPos);
|
||||||
- set.remove(player);
|
- set.remove(player);
|
||||||
- if (set.isEmpty()) {
|
- if (set.isEmpty()) {
|
||||||
+ if (set == null) return; // CraftBukkit - SPIGOT-6208
|
+ // Paper start - some state corruption happens here, don't crash, clean up gracefully
|
||||||
+ if (set != null) set.remove(player); // Paper - some state corruption happens here, don't crash, clean up gracefully
|
+ if (set != null) {
|
||||||
+ if (set == null || set.isEmpty()) { // Paper
|
+ set.remove(player);
|
||||||
|
+ }
|
||||||
|
+ if (set == null || set.isEmpty()) {
|
||||||
|
+ // Paper end - some state corruption happens here, don't crash, clean up gracefully
|
||||||
this.playersPerChunk.remove(packedChunkPos);
|
this.playersPerChunk.remove(packedChunkPos);
|
||||||
this.naturalSpawnChunkCounter.update(packedChunkPos, Integer.MAX_VALUE, false);
|
this.naturalSpawnChunkCounter.update(packedChunkPos, Integer.MAX_VALUE, false);
|
||||||
this.playerTicketManager.update(packedChunkPos, Integer.MAX_VALUE, false);
|
this.playerTicketManager.update(packedChunkPos, Integer.MAX_VALUE, false);
|
||||||
|
|
|
@ -131,11 +131,12 @@
|
||||||
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
|
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
|
||||||
boolean flag1 = this.chunkMap.promoteChunkMap();
|
boolean flag1 = this.chunkMap.promoteChunkMap();
|
||||||
this.chunkMap.runGenerationTasks();
|
this.chunkMap.runGenerationTasks();
|
||||||
@@ -315,17 +_,38 @@
|
@@ -315,17 +_,39 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
- this.save(true);
|
- this.save(true);
|
||||||
|
+ // CraftBukkit start
|
||||||
+ this.close(true);
|
+ this.close(true);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -209,13 +210,12 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSpawnSettings(boolean spawnSettings) {
|
public void setSpawnSettings(boolean spawnSettings) {
|
||||||
- this.spawnEnemies = spawnSettings;
|
|
||||||
- this.spawnFriendlies = this.spawnFriendlies;
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ this.setSpawnSettings(spawnSettings, this.spawnFriendlies);
|
+ this.setSpawnSettings(spawnSettings, this.spawnFriendlies);
|
||||||
+ }
|
+ }
|
||||||
+ public void setSpawnSettings(boolean spawnEnemies, boolean spawnFriendlies) {
|
+ public void setSpawnSettings(boolean spawnSettings, boolean spawnFriendlies) {
|
||||||
+ this.spawnEnemies = spawnEnemies;
|
this.spawnEnemies = spawnSettings;
|
||||||
|
- this.spawnFriendlies = this.spawnFriendlies;
|
||||||
+ this.spawnFriendlies = spawnFriendlies;
|
+ this.spawnFriendlies = spawnFriendlies;
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue