Stop zombies from spawning naturally?

Discussion in 'Plugin Development' started by Gawdzahh, Feb 17, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Gawdzahh

    I'm trying to make something where zombies can only be spawned by Bukkit, I tried using UUIDs and Hashmaps but I couldn't find out how to get a zombies UUID before it actually spawns.

    All help greatly appreciated.
     
  2. Offline

    Double0negative

    You wan't zombies not to spawn but then you do? not sure what your wanting here.
     
  3. Try to get the Spawn Reason.



    I think naturally spawned have other spawn reasons than Egg spawned
     
  4. Offline

    Gawdzahh

    Yeah I ended up working it out using this
    Code:java
    1. @EventHandler
    2. public void onCreatureSpawn(CreatureSpawnEvent event){
    3. EntityType type = event.getEntityType();
    4. if(type == EntityType.ZOMBIE){
    5. if(event.getSpawnReason() != SpawnReason.CUSTOM){
    6. event.setCancelled(true);
    7. }
    8. }
    9. }
     
    Johnny Crazy likes this.
Thread Status:
Not open for further replies.

Share This Page