Disabling Mob Spawn (With a Plugin)

Discussion in 'Plugin Development' started by Intelli, Mar 17, 2011.

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

    Intelli

    Hey everyone,

    For disabling mob spawning with a plugin, what would be the most efficient method?

    Here's what I currently have:

    Code:
     @Override
    public void onCreatureSpawn(CreatureSpawnEvent event) {
    event.setCancelled(true);
    }
    
    Is this the most efficient method for doing it via a plugin, or is there a better way?

    Thanks!
     
  2. Offline

    SpaceManiac

    Nope, that's about it.
     
  3. Offline

    Intelli

    Hmm, too bad. It really seems to eat up the CPU.
     
  4. Offline

    SpaceManiac

    Hmm, any reason you can't disable them in server.properties? You still need to be able to summon 'em for whatever reason? I noticed that the server seems to try to work to uphold a particular number of mobs at once, and it has to keep trying to spawn another each time you cancel, so that could be the culprit.
     
  5. Offline

    Intelli

    Well, I've actually made a plugin that limits the number of mobs. So if the CPU is over 75%, it doesn't spawn any more mobs until the CPU load drops back down. It works, but it's not as efficient as it should be.
     
Thread Status:
Not open for further replies.

Share This Page