How can I stop animals/mobs to pop ?

Discussion in 'Plugin Development' started by sbeex, Oct 3, 2011.

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

    sbeex

    Hi all ! :)

    First of all I've got a big problem and I don't know if it comes from my server config or from my plugin.

    I setted my server configuration like that :

    But... mobs continue coming... does it apply only for the main world ?

    And I did a small plugin to remove mobs and animals only on one world called PVP but it doesn't works better...

    [JAVA] public void onEnable() {
    // TODO Auto-generated method stub
    log.info("[MobsManager] ENABLED ! v0.1 by sbeex");

    List<World> worlds = this.getServer().getWorlds();
    for(int i=0; i<worlds.size(); i++){
    if(worlds.get(i).getName().equalsIgnoreCase("PVP")){
    worlds.get(i).setPVP(true);
    worlds.get(i).setSpawnFlags(true, true);
    }
    else{
    worlds.get(i).setPVP(false);
    worlds.get(i).setSpawnFlags(false, false); // Disable animals and mobs
    }
    }
    }[/JAVA]
    No errors are written in the console but... it doesn't do anything...

    How can I do ? Thank's for your help :)
     
  2. Interesting. I wonder if its broken :confused:
     
  3. Offline

    wassilij

    Hmm .. maybe there are Mob-Spawner?
     
  4. Offline

    sbeex

    I partially solved the problem by adding an entity event listener. onentityspawn() event.setCancelled(true)

    But... it doesn't kill all mobs that are already present.
     
  5. Offline

    Pasukaru

    You could also use an EntityLister and register the CreatureSpawn event.
    Inside the listener, use the onCreatureSpawn(CreatureSpawnEvent event) method and cancel the event to prevent mobs/animals from spawning.
     
  6. Offline

    sbeex

    sorry yeah that's what I've done ^^ but some mob still alive when I connect. But it seems than no more comes.
     
  7. Offline

    Pasukaru

    They probably spawned before the plugin was enabled. :p
     
  8. Offline

    sbeex

    yeah but how do you explain the fact that... when I add a loop in my method onEnable(), it remove not all of them ?
    ... and why the simple methods doesn't works ? Is there somewhere where I can report this bug for the bukkit team ?
     
Thread Status:
Not open for further replies.

Share This Page