WorldGuard icon indicating copy to clipboard operation
WorldGuard copied to clipboard

Add support for inverted deny-spawn flag using "!" prefix (whitelist mode)

Open asmolfemboi opened this issue 1 month ago • 0 comments

The Problem

Currently the deny-spawn flag only works as a blacklist: you can prevent specific mob types from spawning, but there is no built-in way to do the opposite – allow only one (or a few) specific mob types while blocking all others.

This is a common use case for themed builds, mob farms, special events or adventure maps where you want exactly one type of mob to spawn naturally (e.g. only pigs in a giant farm area, only villagers in a village protection, only wither skeletons in a custom nether fortress, etc.).

Right now the only way to achieve this is by blacklisting 70+ other entity types manually, which is extremely tedious and breaks every time a new mob is added in a Minecraft update.

A Solution

Extend the deny-spawn flag syntax to support inverted selection using the ! prefix, exactly like WorldEdit/WorldGuard already do with selection masks and many other flags.

Proposed command examples:


/rg flag __global__ deny-spawn !pig              → only pigs may spawn, everything else is denied

/rg flag farm deny-spawn !cow,!chicken           → only cows and chickens may spawn

/rg flag village deny-spawn !villager,!iron_golem → only villagers and iron golems may spawn

/rg flag nether deny-spawn !wither_skeleton      → only wither skeletons may spawn

Internally this would be treated as “spawn whitelist” mode: if the list contains at least one entry that starts with !, WorldGuard switches to whitelist logic and denies everything except the un-prefixed types.

Alternatives

  1. Manually blacklist every mob except the desired one

    → Not practical (70+ types right now, growing with every update), error-prone, impossible to maintain.

  2. Use a separate “allow-spawn” flag

    → Would require learning and remembering a second flag, leads to flag conflicts and confusion about priority (does deny-spawn override allow-spawn or vice versa?).

  3. Use external plugins (e.g. MythicMobs, custom spawners, etc.)

    → Overkill for a simple spawn control need, adds extra dependencies, performance overhead and breaks the “WorldGuard does protection” philosophy.

  4. Deny all spawning with deny-spawn * and then use custom spawners

    → Defeats the purpose of natural spawning (e.g. monster spawners, natural mob caps, spawn reasons like “natural”, “jockey”, etc.).

None of these alternatives are as clean, intuitive and future-proof as simply reusing the already familiar ! inversion syntax that WorldGuard and WorldEdit players have been using for years.

Anything Else?

This feature would bring deny-spawn in line with how most other WorldGuard flags already work (blocked-cmds, allowed-cmds, build deny/allow masks, etc.). It requires only a very small syntax addition and no new flag, making it easy to document and understand. The same logic is already implemented in WorldEdit masks and in several other WG flags, so the code change should be minimal and low-risk.

Many server owners (especially on large networks and RPG/adventure servers) have been asking for exactly this feature for years. It would be a highly appreciated quality-of-life improvement.

asmolfemboi avatar Nov 23 '25 20:11 asmolfemboi