MobSpawnEvent partly-disabling

Discussion in 'Plugin Development' started by arjanforgames, Oct 13, 2013.

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

    arjanforgames

    Why is this not working?
    I want mobs only spawned by eggs but they wont spawn if I try it with an egg. (only noise for a short period of time)
    Code:java
    1. @EventHandler
    2. public void mobSpawning(CreatureSpawnEvent event){
    3. if(event.getSpawnReason().equals(SpawnReason.EGG)){
    4.  
    5. }else{
    6. event.setCancelled(true);
    7. }
    8. }
     
  2. Offline

    james137137

    maybe debug it by broadcasting the reason?
    or Sytem.out.println(event.getSpawnReason());
     
  3. Offline

    adam753

    SpawnReason.EGG means when you throw an egg and a chicken spawns. The one you should use is SpawnReason.SPAWNER_EGG.
     
    tommycake50 likes this.
Thread Status:
Not open for further replies.

Share This Page