From c48afbb8ff83582fce5c1378b5aba1bda38211e9 Mon Sep 17 00:00:00 2001 From: ez-plugins Date: Mon, 11 May 2026 01:24:37 +0200 Subject: [PATCH 1/2] feat: add TeamsAPI claim-avoidance integration Adds a soft-optional TeamsAPI protection provider that skips RTP destinations inside claimed chunks. The provider is enabled by default when TeamsAPI (with a claim service) is detected at runtime. - Add TeamsApiProtectionProvider with two-stage safety checks: - plugin-presence check at construction (PluginManager.getPlugin) - dynamic TeamsAPI.isClaimAvailable() on every isAvailable() call - Register provider in ProtectionRegistry - Include 'teamsapi' in ProtectionSettings.DEFAULT_PROVIDERS - Declare TeamsAPI as softdepend in plugin.yml - Add teams-api 1.4.1 provided dependency to ezrtp-common - Update rtp.yml default providers list - Update docs: rtp config reference + protection integrations page - Add teams-api to CI dependency lists (nightly + release workflows) --- .github/workflows/nightly.yml | 1 + .github/workflows/release.yml | 1 + docs/config/rtp.md | 2 + .../protection-worldguard-griefprevention.md | 33 ++++++- ezrtp-common/pom.xml | 6 ++ .../config/safety/ProtectionSettings.java | 2 +- .../ezrtp/protection/ProtectionRegistry.java | 1 + .../TeamsApiProtectionProvider.java | 98 +++++++++++++++++++ .../TeamsApiProtectionProviderTest.java | 52 ++++++++++ src/main/resources/plugin.yml | 1 + src/main/resources/rtp.yml | 1 + 11 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 ezrtp-common/src/main/java/com/skyblockexp/ezrtp/protection/TeamsApiProtectionProvider.java create mode 100644 ezrtp-common/src/test/java/com/skyblockexp/ezrtp/protection/TeamsApiProtectionProviderTest.java diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6947d5f..7c51a58 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -134,6 +134,7 @@ jobs: placeholderapi | optional chunky | optional worldguard | optional + teams-api | optional ezcountdown | optional ezeconomy | optional diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 529d1d7..a22d847 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -155,6 +155,7 @@ jobs: placeholderapi | optional chunky | optional worldguard | optional + teams-api | optional ezcountdown | optional ezeconomy | optional diff --git a/docs/config/rtp.md b/docs/config/rtp.md index fa0e9a7..4d55a34 100644 --- a/docs/config/rtp.md +++ b/docs/config/rtp.md @@ -222,9 +222,11 @@ protection: providers: - worldguard - griefprevention + - teamsapi ``` Set `avoid-claims: true` to enable. Only providers that are installed will be used. +Supported values: `worldguard`, `griefprevention`, `teamsapi`. --- diff --git a/docs/integrations/protection-worldguard-griefprevention.md b/docs/integrations/protection-worldguard-griefprevention.md index 99037b0..9613335 100644 --- a/docs/integrations/protection-worldguard-griefprevention.md +++ b/docs/integrations/protection-worldguard-griefprevention.md @@ -1,12 +1,12 @@ --- -title: WorldGuard & GriefPrevention +title: WorldGuard, GriefPrevention & TeamsAPI nav_order: 4 parent: Integrations --- -# WorldGuard / GriefPrevention Protection Integration +# Protection Integrations (WorldGuard, GriefPrevention, TeamsAPI) -Use this integration when you want EzRTP to avoid protected regions/claims. +Use these integrations when you want EzRTP to avoid protected regions or claimed chunks. ## What this integration does @@ -14,8 +14,9 @@ When enabled, EzRTP validates candidate RTP locations against configured protect Supported provider names in config: -- `worldguard` -- `griefprevention` +- `worldguard` — WorldGuard protected regions +- `griefprevention` — GriefPrevention claims +- `teamsapi` — Chunk claims managed by any [TeamsAPI](https://modrinth.com/plugin/teams-api)-compatible team plugin If a provider plugin is not installed, EzRTP continues with available providers (safe fallback behavior). @@ -29,6 +30,7 @@ protection: providers: - worldguard - griefprevention + - teamsapi ``` ### Key settings @@ -42,6 +44,25 @@ protection: Why here: claim/region safety is part of RTP destination validation, so it belongs in `rtp.yml`. +## TeamsAPI claim avoidance + +TeamsAPI is a universal bridge between Minecraft team / faction plugins and consumer plugins. +When a team plugin that supports chunk claiming registers a `TeamsClaimService` with TeamsAPI, +EzRTP automatically detects this and avoids claimed chunks during RTP destination search. + +**Requirements:** + +- [TeamsAPI](https://modrinth.com/plugin/teams-api) plugin installed (soft-depend — not mandatory). +- A compatible team plugin with claim support installed alongside TeamsAPI. + +**Behaviour:** + +- If TeamsAPI is absent or no claim provider is registered, the `teamsapi` entry in + `providers` is silently skipped. No errors are logged unless `avoid-claims: true` and + *all* configured providers are unavailable. +- Claim availability is re-checked dynamically, so a claim plugin that loads after EzRTP + is picked up without requiring a reload. + ## Optional WorldGuard region command mode You can also enable region-centric command routing: @@ -61,5 +82,7 @@ worldguard: ## Recommended settings by server type - **Survival / Towny-like protection-heavy servers:** set `avoid-claims: true`. +- **Factions / Teams servers using TeamsAPI:** set `avoid-claims: true` and ensure + `teamsapi` is in `providers`. - **Minigame / event servers with custom handling:** keep `avoid-claims: false` unless conflicts occur. - **Mixed networks:** enable only on servers where claim boundaries matter. diff --git a/ezrtp-common/pom.xml b/ezrtp-common/pom.xml index 9e473c8..1d43bbc 100644 --- a/ezrtp-common/pom.xml +++ b/ezrtp-common/pom.xml @@ -73,6 +73,12 @@ 2.12.2 provided + + com.github.ez-plugins + teams-api + 1.4.1 + provided +