Avoid NPE with ibc

https://github.com/BentoBoxWorld/Limits/issues/157
This commit is contained in:
tastybento 2022-01-21 18:53:45 -08:00
parent 360ba0b2de
commit e8dffc76f5
1 changed files with 2 additions and 2 deletions

View File

@ -406,7 +406,7 @@ public class EntityLimitListener implements Listener {
.filter(e -> e.getType().equals(ent.getType()))
.filter(e -> island.inIslandSpace(e.getLocation()))
.count();
int max = limitAmount + ibc.getEntityLimitOffset(ent.getType());
int max = limitAmount + (ibc == null ? 0 : ibc.getEntityLimitOffset(ent.getType()));
if (count >= max) {
return new AtLimitResult(ent.getType(), max);
}
@ -426,7 +426,7 @@ public class EntityLimitListener implements Listener {
int count = (int) ent.getWorld().getEntities().stream()
.filter(e -> group.getKey().contains(e.getType()))
.filter(e -> island.inIslandSpace(e.getLocation())).count();
int max = group.getValue() + ibc.getEntityGroupLimitOffset(group.getKey().getName());
int max = group.getValue() + + (ibc == null ? 0 : ibc.getEntityGroupLimitOffset(group.getKey().getName()));
if (count >= max) {
return new AtLimitResult(group.getKey(), max);
}