public void destroy() { entity.remove(); CustomEntityHandler.unRegister(this.entity); this.name = null; this.entity = null; this.random = null; this.plugin = null; }
public CustomEntity(LivingEntity entity, Plugin plugin) { this.entity = entity; this.level = getZoneLevel(); this.plugin = plugin; CustomEntityHandler.register(this.entity, this.entity.getUniqueId(), this); if (entity.getType() == EntityType.ZOMBIE || entity.getType() == EntityType.SKELETON) { this.setLeveledArmor(); } this.autoLevel(); }
public static CustomEntity spawn(EntityType type, Location loc, int level) { Entity entity = loc.getWorld().spawnEntity(loc, type); CustomEntityHandler.getCustomEntity(entity).setLevel(level); return CustomEntityHandler.getCustomEntity(entity); }
@SuppressWarnings("unused") public void onDeath(EntityDeathEvent event) { CustomEntityHandler.unRegister(this.entity); Location loc = this.entity.getLocation(); dropExp(entity, level * 6); }