WorldGuard

WorldGuard

8M Downloads

Mob spawning flag needs to actively remove mobs

sk89q opened this issue · 11 comments

commented

The mob spawning flag needs to actively remove mobs.

commented

What do you mean, doesn't "event.setCancelled()" in onCreatureSpawn() do that?

commented

Oh, a mob can walk into the region.

commented

Should the mob spawning flag avoid that?

commented

It should remove mobs as well.

However, that is pretty CPU intensive so it has to be an option that can be turned off or on.

commented

But what excactly does the setCancelled(true) do then? And to prevent mobs from entering a region we'll need some event like EntityMoveEvent.

commented

It prevents the mob from spawning.

But a mob can spawn from just outside and walk in. To prevent mobs from entering, it'd require an expensive loop through all entities constantly.

commented

Wouldn't that cause lag? Is there some specific reason that Bukkit have no EntityMoveEvent? That whould be a better solution.

commented

Indeedly so, but people want it. It can be an feature that has to be enabled explicitly. That way those that want it and have the power to use it can use it, and for everyone else, they don't have to deal with it.

The event system in Bukkit is really heavy. Move events should not exist.

commented

I know. It's would be spamming, But so are CHUNK_LOAD too. It whould be really usefull for specific tasks. If Bukkit add EntityMoveEvent it should only be triggered when a LivingEntity moves, and not all entities. But if we add a constant loop where we check if an entity is inside a region. I think that would be more spamming than an EntityMoveEvent. And almost every server that run Bukkit, run WorldEdit + WorldGuard too. So then a EntityMoveEvent maybe whould be better anyway.

commented

I think i found a solution. We can use the FlagStateManager that is based on ticks. To check entities position, i think this would be better than a infinite loop. But you mean we should remove mobs that enter the region? Is there some other options? Maybe teleport entity back to position when enter region?

commented

Please make this optional in case you implement it.

Mobs being able to accidentally walk into your «safe» region add so much to roleplaying feeling.