diff --git a/core/src/main/java/de/erethon/dungeonsxl/mob/DMob.java b/core/src/main/java/de/erethon/dungeonsxl/mob/DMob.java index 619fbbb7..90f46d18 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/mob/DMob.java +++ b/core/src/main/java/de/erethon/dungeonsxl/mob/DMob.java @@ -17,6 +17,7 @@ package de.erethon.dungeonsxl.mob; import de.erethon.caliburn.mob.ExMob; +import de.erethon.caliburn.mob.VanillaMob; import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.api.dungeon.GameRule; import de.erethon.dungeonsxl.api.event.mob.DungeonMobDeathEvent; @@ -45,9 +46,9 @@ public class DMob implements DungeonMob { public DMob(LivingEntity entity, GameWorld gameWorld, ExMob type, String trigger) { this.entity = entity; - this.type = type; + this.type = type != null ? type : VanillaMob.get(entity.getType()); - if (!getDrops(gameWorld.getDungeon().getRules().getState(GameRule.MOB_ITEM_DROPS))) { + if (this.type != VanillaMob.PLAYER && !getDrops(gameWorld.getDungeon().getRules().getState(GameRule.MOB_ITEM_DROPS))) { entity.getEquipment().setHelmetDropChance(0); entity.getEquipment().setChestplateDropChance(0); entity.getEquipment().setLeggingsDropChance(0); diff --git a/core/src/main/java/de/erethon/dungeonsxl/mob/DNPCRegistry.java b/core/src/main/java/de/erethon/dungeonsxl/mob/DNPCRegistry.java index c2bb1f19..7e60b5b4 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/mob/DNPCRegistry.java +++ b/core/src/main/java/de/erethon/dungeonsxl/mob/DNPCRegistry.java @@ -16,8 +16,6 @@ */ package de.erethon.dungeonsxl.mob; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.Iterator; import java.util.UUID; import net.citizensnpcs.Settings.Setting; @@ -31,6 +29,8 @@ import net.citizensnpcs.api.trait.Trait; import net.citizensnpcs.api.trait.trait.MobType; import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.util.MemoryDataKey; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.EntityControllers; import net.citizensnpcs.trait.ArmorStandTrait; import net.citizensnpcs.trait.LookClose; import net.citizensnpcs.trait.MountTrait; @@ -50,16 +50,7 @@ public class DNPCRegistry implements NPCRegistry { @Override public NPC createNPC(EntityType type, UUID uuid, int id, String name) { - NPC npc = null; - try { - Method method = CitizensAPI.getNPCRegistry().getClass().getDeclaredMethod("getByType", EntityType.class, UUID.class, int.class, String.class); - method.setAccessible(true); - npc = (NPC) method.invoke(CitizensAPI.getNPCRegistry(), type, uuid, id, name); - - } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { - throw new IllegalStateException("Could not create NPC: " + exception.getClass().getSimpleName()); - } - + NPC npc = new CitizensNPC(uuid, id, name, EntityControllers.createForType(type), this); if (npc == null) { throw new IllegalStateException("Could not create NPC: npc is null"); }