Fix #getDungeonMob() NPE

This commit is contained in:
Daniel Saukel 2020-05-02 00:45:58 +02:00
parent 612fb6828e
commit df48257ef5

View File

@ -707,6 +707,9 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
@Override @Override
public DungeonMob getDungeonMob(LivingEntity entity) { public DungeonMob getDungeonMob(LivingEntity entity) {
GameWorld gameWorld = getGameWorld(entity.getWorld()); GameWorld gameWorld = getGameWorld(entity.getWorld());
if (gameWorld == null) {
return null;
}
for (DungeonMob mob : gameWorld.getMobs()) { for (DungeonMob mob : gameWorld.getMobs()) {
if (mob.getEntity() == entity) { if (mob.getEntity() == entity) {
return mob; return mob;