05-06-2013, 09:38 PM
OnTick() shouldn't do a ForEach anything, because that could slow the server down considerably.
I think you should wait with this plugin until there's proper mob AI, because then we'll have a full set of hooks for all entity-related needs, such as OnMobSpawning() etc.
Another idea that could work even now is to count all the mobs at one moment with ForEachEntity(), then subtract one from this counter each time a mob is killed (OnTakeDamage() when damage is more than life left). This should give you a pretty accurate picture, providing that mobs don't spawn in the meantime.
Anyway, still there's no way for you to disable mob spawning or to spawn more mobs from a plugin, so, as I said, better wait (and give Keyboard some motivation to do the AI )
I think you should wait with this plugin until there's proper mob AI, because then we'll have a full set of hooks for all entity-related needs, such as OnMobSpawning() etc.
Another idea that could work even now is to count all the mobs at one moment with ForEachEntity(), then subtract one from this counter each time a mob is killed (OnTakeDamage() when damage is more than life left). This should give you a pretty accurate picture, providing that mobs don't spawn in the meantime.
Anyway, still there's no way for you to disable mob spawning or to spawn more mobs from a plugin, so, as I said, better wait (and give Keyboard some motivation to do the AI )