WorldGuard Build #2398

This is not a stable download!

We recommend the use of released versions whenever possible.

View Stable Downloads
ProjectWorldGuard
StatusSUCCESS
Branchversion/7.0.x
Number#2398-7c280a1
Datea day ago
Artifacts
Changes
IDSummaryCommitterDate
7c280a13
  • Cancel blocked natural spawns before the entity is created (#2300)
    • Cancel blocked natural spawns before the entity is created The mob-spawning and deny-spawn checks in WorldGuardEntityListener fire on CreatureSpawnEvent, at the very end of the spawn pipeline. By that point the server has picked a spawn position, run the placement checks, constructed the mob and run finalizeSpawn, and the cancelled mob is thrown away. Since a cancelled spawn never counts toward the mob cap, the natural spawner keeps retrying the same area at full rate, so regions that deny mob spawning become permanent spawn attempt hotspots that pay entity construction over and over for nothing. On Paper servers the same checks can run in PreCreatureSpawnEvent, before the entity exists. Cancelling there also ends the remaining attempts for the chunk in that spawn cycle, so the wasted work is gone almost entirely. Measured on a flat test world with a region denying mob-spawning over the whole spawn range and the mob cap kept empty, the attempt rate around a single player collapsed from roughly 75000 attempts per second to roughly 60 per second, with no entities constructed at all. The new listener mirrors the natural spawn conditions from onCreatureSpawn exactly: activity halt, block-creature-spawn, mob-spawning and deny-spawn region flags, and block-ground-slimes. All other spawn reasons keep going through the existing CreatureSpawnEvent checks unchanged, and the listener is only registered when the Paper event class is present.
    • Move the pre spawn handler into the existing Paper inner listener Review feedback: platform specific code lives in the Paper inner classes of the main listeners, and WorldGuardEntityListener already has one for EntityZapEvent, so the handler moves in there and the separate listener class is gone.
    • Match the HIGH priority of the other protection handlers
    • Extract the shared spawn checks into a method used by both handlers The pre spawn handler duplicated the...
rasmus kjær damgaarda day ago