EngineHub / WorldGuard

🛡️ Protect your Minecraft server and lets players claim areas
https://enginehub.org/worldguard/
Other
826 stars 543 forks source link

Flags to Prevent Monsters From Enterion a Region, and/or to Prevent Mobs From Dropping Loot inside a Region #1777

Open awsomebot opened 3 years ago

awsomebot commented 3 years ago

Is your feature request related to a problem? Please describe. Currently a region that protects players from taking damage from hostile mobs can be used by players to lure hostile mobs into the region and safely kill them to farm EXP and items without taking any damage.

Describe the solution you'd like A flag to prevent hostile mobs from entering a region would prevent this. If a hostile mob walks into the region , they would despawn. And if they aggro a player who is in the region, they would despawn immediately no matter how far away they are from the region (this prevents having the players deal with constant hordes of zombies who walk towards the region and despawn right at the border)

Describe alternatives you've considered A flag to prevent mobs from dropping EXP and items would also work great. This would prevent players from intentionally farming mobs in the safe region. I thought the flags "item-drops" and "exp-drops" being set to false would already do this but in my testing I saw these flags only effect players, not mobs. I think such flags would be a great addition even if my original suggestion were to be implemented, as they could serve different purposes.

Additional context Flags to prevent mobs entering certain regions and dropping loot in certain regions already exist in the plugin GriefPrevention Flags ("NoMonsters" and "NoCombatLoot" respectively). However this plugin was recently discontinued and will soon be outdated, and it is not flexible as WorldGuard. Here's a simple demonstration showing how "NoMonsters" works Video link. Notice that the second zombie despawned immediately because I was already in the zone when he aggroed to me. One side note about how they implement this is that mobs can still idly wander into the zone. However they will despawn the moment they try to attack anyone inside the zone.

wizjany commented 3 years ago

Currently a region that protects players from taking damage from hostile mobs can be used by players to lure hostile mobs into the region and safely kill them to farm EXP and items without taking any damage.

fyi there's an incinvibility-removes-mobs config option or something like that which might just solve your root problem.

i'll leave this open since it's commonly requested yet somehow not a duplicate issue though. the implementation is prob up for debate since spigot doesn't have entity movement checking so various other plugins that do this either have to a) use targeting events b) scan all entities on a task to check position c) use paper-specific events (movement, pathfinding) which all have their various (dis)merits so yea idk

Goldentoenail commented 3 years ago

Spigot has a method EntityTargetEntityEvent() (I think that is what it is called) If that event is triggered with a defined perimeter of a region and a flag is set, the Entity 'monster' can be optionaly removed | deflected or killed, and the target event cancelled. Something like /region monster-deny-entry <remove | deflect | kill> So, if an external 'monster' is attracted towards a player within the specified region + safeboundary the 'monster' Entity can be dealt with. (The safe boundary is there to negate a player's reach or weapon, etc. used to kill an Entity)