@EventHandler private void unloadChunks(ChunkUnloadEvent e){ if(e.getChunk().getEntities().length > 0) e.setCancelled(true); } public static org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity spawnMob(final CustomMob customMob, final Location loc){ if(!loc.getChunk().isLoaded()) loc.getChunk().load(); customMob.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); ((CraftWorld)loc.getWorld()).getHandle().addEntity(customMob, CreatureSpawnEvent.SpawnReason.CUSTOM); SPAWNED_MOBS.add(customMob); customMob.afterSpawn(loc); return ((EntityMonster) customMob).getBukkitEntity(); }