feat: add protected emergency build cleanup
Build / build (push) Failing after 11s

This commit is contained in:
Michael Burgess
2026-08-17 09:00:09 -04:00
parent d0f0133f57
commit d3ea6c5cc2
10 changed files with 488 additions and 3 deletions
+33 -3
View File
@@ -34,6 +34,7 @@ Creative and spectator players do not receive rewards by default. Creative earni
- Java 25 for compilation/server runtime
- JobsReborn 5.2.6.x
- CMILib, as required by JobsReborn
- GriefPrevention 16.18.6+ (optional; enables protected-claim emergency building)
- A JobsReborn-compatible economy if monetary payouts are desired
## Build
@@ -110,7 +111,7 @@ Other management commands:
Automatic emergencies default to a random 30-60 minute interval and require at least one online Firefighter. Manual starts use the same online-Firefighter requirement unless `emergencies.require-firefighters-online` is disabled.
Emergency fire generation:
Emergency fire generation and response behavior:
- Uses admin-defined named sites and radii.
- Can be limited to configured world names with `emergencies.allowed-worlds`.
@@ -119,7 +120,13 @@ Emergency fire generation:
- Cancels emergency-fire spread and spread ignition.
- Cancels nearby block burning.
- Tracks and removes remaining emergency fire on completion, manual stop, expiry, plugin disable, or server shutdown.
- Periodically removes stale tracked entries if an emergency fire disappears through another legitimate game event.
- Grants on-duty Firefighters the temporary `rosefirefighter.emergency.build` runtime permission while an incident is active.
- When GriefPrevention is installed, uses its claim-permission API to allow block placement and water-bucket response only inside the active site. Emergency fire and tracked temporary response blocks can also be broken there.
- Does **not** grant `/IgnoreClaims` or global `griefprevention.adminclaims`, so an incident does not become a server-wide claim bypass.
- Tracks blocks Firefighters place at the incident and restores the replaced block state when the incident ends.
- Returns one consumed placement item per still-tracked placement to the Firefighter who placed it. Blocks the player already broke are removed from the return ledger to avoid duplication.
- Saves returns for offline Firefighters in `pending-returns.yml` and delivers them on their next join.
- Periodically removes stale tracked fire entries if an emergency fire disappears through another legitimate game event.
- Broadcasts configurable alerts, by default to all online players.
Example alert:
@@ -128,6 +135,22 @@ Example alert:
🔥 FIRE ALERT! A fire has been reported at RoseGarden near X:123 Y:64 Z:-245. Firefighters are needed immediately!
```
## Protected-site integration
`emergencies.protected-site-building` controls temporary emergency build access. The permission is granted with Bukkit's runtime `PermissionAttachment`, so it is temporary and does not create permanent LuckPerms/permissions-plugin data.
With GriefPrevention installed, RoseFirefighter listens to `ClaimPermissionCheckEvent` and clears a denied `Build` check only when all of the following are true:
- An emergency is active.
- The player is currently working the JobsReborn Firefighter job.
- The player currently has RoseFirefighter's temporary emergency-build attachment.
- The affected block is inside the active site's configured radius.
- The action is placing a block, emptying a bucket, breaking an emergency fire, or breaking a tracked temporary Firefighter block.
Normal protected structures cannot be broken merely because an emergency is active.
`emergencies.cleanup-firefighter-blocks` controls whether placements made by Firefighters inside the active site are added to the temporary response-construction ledger.
## Configuration
`src/main/resources/config.yml` includes controls for:
@@ -144,6 +167,7 @@ Example alert:
- Emergency reward multiplier.
- Announcement behavior.
- Permitted emergency worlds.
- Protected-site emergency building and temporary Firefighter block cleanup.
- Saved emergency sites.
## Development notes
@@ -160,4 +184,10 @@ JobsReborn is referenced through its documented JitPack coordinate:
compileOnly("com.github.Zrips:Jobs:v5.2.6.2")
```
The JobsReborn dependency is non-transitive because RoseFirefighter only needs the JobsReborn API classes and should not pull JobsReborn's optional integration dependencies into its compile classpath.
GriefPrevention is an optional compile-time API dependency and a runtime soft dependency:
```kotlin
compileOnly("com.github.GriefPrevention:GriefPrevention:16.18.6")
```
The JobsReborn and GriefPrevention dependencies are non-transitive because RoseFirefighter only needs their public API classes and should not pull their optional integrations into its compile classpath.