Suppress errors due to failed getEntitySpawnReason implementation (#4334)

fix: suppress errors due to failed getEntitySpawnReason implementation
This commit is contained in:
Pierre Maurice Schwang 2024-02-12 18:32:27 +01:00 committed by GitHub
parent 0de6887526
commit d9537ee9df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -779,7 +779,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
Iterator<Entity> iterator = entities.iterator(); Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = iterator.next(); Entity entity = iterator.next();
if (PaperLib.isPaper() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) { //noinspection ConstantValue - getEntitySpawnReason annotated as NotNull, but is not NotNull. lol.
if (PaperLib.isPaper() && entity.getEntitySpawnReason() != null && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
continue; continue;
} }
// Fallback for Spigot not having Entity#getEntitySpawnReason // Fallback for Spigot not having Entity#getEntitySpawnReason

View File

@ -124,7 +124,8 @@ public class EntitySpawnListener implements Listener {
return; return;
} }
if (PaperLib.isPaper()) { if (PaperLib.isPaper()) {
if (area.isSpawnCustom() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) { //noinspection ConstantValue - getEntitySpawnReason annotated as NotNull, but is not NotNull. lol.
if (area.isSpawnCustom() && entity.getEntitySpawnReason() != null && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
return; return;
} }
} }