Skip to content

Commit

Permalink
Suppress errors due to failed getEntitySpawnReason implementation (#4334
Browse files Browse the repository at this point in the history
)

fix: suppress errors due to failed getEntitySpawnReason implementation
  • Loading branch information
PierreSchwang authored Feb 12, 2024
1 parent 0de6887 commit d9537ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ private void runEntityTask() {
Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) {
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;
}
// Fallback for Spigot not having Entity#getEntitySpawnReason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public void creatureSpawnEvent(EntitySpawnEvent event) {
return;
}
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;
}
}
Expand Down

0 comments on commit d9537ee

Please sign in to comment.