mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-25 11:19:44 +01:00
parent
1005b29e96
commit
82af006ea4
@ -1,4 +1,5 @@
|
||||
Version 2.2.034
|
||||
Fixed a rare edge case where null entities during chunk unload would cause a NullPointerException and potentially lead to server instability
|
||||
Fixed bug where arrow would award archery xp after a crossbow trickshot bounce
|
||||
|
||||
Version 2.2.033
|
||||
|
@ -15,9 +15,18 @@ public class ChunkListener implements Listener {
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
final Chunk unloadingChunk = event.getChunk();
|
||||
|
||||
Arrays.stream(unloadingChunk.getEntities())
|
||||
.filter(entity -> entity instanceof LivingEntity)
|
||||
.map(entity -> (LivingEntity) entity)
|
||||
.forEach(livingEntity -> mcMMO.getTransientEntityTracker().removeTrackedEntity(livingEntity));
|
||||
// Avoid processing if chunk is null or unloaded
|
||||
if (unloadingChunk == null || !unloadingChunk.isLoaded() || unloadingChunk.getEntities() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Arrays.stream(unloadingChunk.getEntities())
|
||||
.filter(entity -> entity instanceof LivingEntity)
|
||||
.map(entity -> (LivingEntity) entity)
|
||||
.forEach(livingEntity -> mcMMO.getTransientEntityTracker().removeTrackedEntity(livingEntity));
|
||||
} catch (Exception ex) {
|
||||
mcMMO.p.getLogger().warning("Caught exception during chunk unload event processing: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user