From 328b9340751642f181d8bf8ce677085ca5b821f8 Mon Sep 17 00:00:00 2001 From: ez-plugins Date: Sun, 19 Apr 2026 21:51:46 +0200 Subject: [PATCH 1/3] fix(build): build only api module on JitPack to avoid MockBukkit resolution Maven resolves the full dependency graph upfront before any lifecycle phase, so -Dmaven.test.skip=true cannot prevent test-scoped dependency resolution. Building only the api module (-pl api) excludes the plugin module entirely, which is correct since JitPack consumers only depend on ezseasons-api. --- jitpack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jitpack.yml b/jitpack.yml index 0e6229a..a4ada8a 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -2,4 +2,4 @@ jdk: - openjdk25 install: - - ./mvnw --batch-mode --no-transfer-progress clean install -Dmaven.test.skip=true + - ./mvnw --batch-mode --no-transfer-progress clean install -pl api -Dmaven.test.skip=true From d7729dd6e65b59029845f953e3712afd9a3936d5 Mon Sep 17 00:00:00 2001 From: ez-plugins Date: Sun, 19 Apr 2026 21:53:55 +0200 Subject: [PATCH 2/3] fix(api): pin paper-api to 1.21.4 stable snapshot The API only uses org.bukkit.event.Event and HandlerList, which have been stable since Bukkit 1.0. Pinning to 1.21.4-R0.1-SNAPSHOT decouples the API artifact from the server version so it does not need to be updated when the plugin targets a newer Minecraft/Paper release. --- api/pom.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/pom.xml b/api/pom.xml index 5768eb9..e9f81ad 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,10 +16,13 @@ Public API for EzSeasons integrations + io.papermc.paper paper-api - ${paper.version} + 1.21.4-R0.1-SNAPSHOT provided From 6f02aa6b2cfc7a739d6fa2927239c90c6ac8a3cb Mon Sep 17 00:00:00 2001 From: ez-plugins Date: Sun, 19 Apr 2026 22:06:00 +0200 Subject: [PATCH 3/3] refactor(api): remove paper-api dependency; add onSeasonReset callback - api/pom.xml: remove paper-api provided dependency (API is now pure Java) - SeasonsIntegration: add default onSeasonReset(previousResetMillis, resetMillis, nextResetMillis, reason) no-op callback; existing implementations unaffected - Move SeasonResetEvent, SeasonsIntegrationRegisteredEvent, SeasonsIntegrationUnregisteredEvent from api module to plugin module (same FQN preserved; existing @EventHandler listeners recompile against plugin JAR) - SeasonManager: call onSeasonReset on all registered integrations after Bukkit event - EzSeasonsPlugin: expose getSeasonsApi() delegating to registry - docs/api.md: document onSeasonReset, note events are in plugin JAR - Bump version 2.0.3 -> 2.1.0 --- api/pom.xml | 14 ++------------ .../seasons/api/SeasonsIntegration.java | 19 +++++++++++++++++-- docs/api.md | 13 ++++++++----- plugin/pom.xml | 2 +- .../lifesteal/seasons/EzSeasonsPlugin.java | 4 ++++ .../lifesteal/seasons/SeasonManager.java | 7 +++++++ .../seasons/api/events/SeasonResetEvent.java | 0 .../SeasonsIntegrationRegisteredEvent.java | 0 .../SeasonsIntegrationUnregisteredEvent.java | 0 pom.xml | 2 +- 10 files changed, 40 insertions(+), 21 deletions(-) rename {api => plugin}/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonResetEvent.java (100%) rename {api => plugin}/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationRegisteredEvent.java (100%) rename {api => plugin}/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationUnregisteredEvent.java (100%) diff --git a/api/pom.xml b/api/pom.xml index e9f81ad..d9fbd74 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ com.skyblockexp.lifesteal ezseasons-parent - 2.0.3 + 2.1.0 ezseasons-api @@ -15,17 +15,7 @@ EzSeasons API Public API for EzSeasons integrations - - - - io.papermc.paper - paper-api - 1.21.4-R0.1-SNAPSHOT - provided - - + diff --git a/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/SeasonsIntegration.java b/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/SeasonsIntegration.java index c1fa5e4..138f33f 100644 --- a/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/SeasonsIntegration.java +++ b/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/SeasonsIntegration.java @@ -1,5 +1,5 @@ -package com.skyblockexp.lifesteal.seasons.api; - +package com.skyblockexp.lifesteal.seasons.api; + /** * Interface for plugins to implement to integrate with EzSeasons. * Register your implementation via {@link SeasonsApi#registerIntegration(SeasonsIntegration)}. @@ -22,4 +22,19 @@ public interface SeasonsIntegration { * @throws RuntimeException propagated to the unregistering caller; EzSeasons does not swallow or log it here */ void onUnregister(); + + /** + * Called after EzSeasons performs a season reset. + *

+ * The default implementation is a no-op, so existing implementations are not required to override this method. + *

+ * Threading: invoked on the same thread that triggered the reset (typically the Bukkit main thread). + * + * @param previousResetMillis unix epoch ms of the reset immediately before this one + * @param resetMillis unix epoch ms of this reset + * @param nextResetMillis unix epoch ms of the next scheduled reset, or {@code 0} if unscheduled + * @param reason caller-provided reason; never {@code null} — defaults to {@code "unspecified"} + */ + default void onSeasonReset(long previousResetMillis, long resetMillis, long nextResetMillis, String reason) { + } } diff --git a/docs/api.md b/docs/api.md index 667fabc..284fe0b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -39,7 +39,7 @@ You can use either GitHub Packages (official) or JitPack. com.skyblockexp.lifesteal ezseasons-api - 2.0.3 + 2.1.0 provided @@ -61,7 +61,7 @@ You can use either GitHub Packages (official) or JitPack. com.github.ez-plugins.EzSeasons ezseasons-api - v2.0.3 + v2.1.0 provided @@ -69,7 +69,7 @@ You can use either GitHub Packages (official) or JitPack. ## Threading -All public API methods are safe to call from concurrent threads — the integration registry is internally synchronized. However, **callbacks** (`onRegister`, `onUnregister`) and **Bukkit events** (`SeasonResetEvent`, etc.) are fired on the calling thread. In typical usage this is the Bukkit main thread. +All public API methods are safe to call from concurrent threads — the integration registry is internally synchronized. However, **callbacks** (`onRegister`, `onUnregister`, `onSeasonReset`) and **Bukkit events** (`SeasonResetEvent`, etc.) are fired on the calling thread. In typical usage this is the Bukkit main thread. --- @@ -90,7 +90,7 @@ Public service interface registered as a Bukkit service. Obtain it via `Bukkit.g - `registerIntegration` — registry is updated **before** `onRegister` is called and before `SeasonsIntegrationRegisteredEvent` fires. - `unregisterIntegration` — registry is updated **before** `onUnregister` is called and before `SeasonsIntegrationUnregisteredEvent` fires. -- `triggerSeasonReset` — timestamps are persisted **before** `SeasonResetEvent` fires. +- `triggerSeasonReset` — timestamps are persisted **before** `SeasonResetEvent` fires and **before** `onSeasonReset` callbacks are invoked. ### `SeasonsIntegration` @@ -100,13 +100,16 @@ Implement this interface in your plugin to receive registration lifecycle callba |---|---| | `onRegister(SeasonsApi api)` | Called after this integration is added to the EzSeasons registry. | | `onUnregister()` | Called after this integration is removed from the EzSeasons registry. | +| `onSeasonReset(long previousResetMillis, long resetMillis, long nextResetMillis, String reason)` | Called after each season reset. Default no-op — override to react to resets without a Bukkit `@EventHandler`. | -Exceptions thrown from either callback propagate to the caller; EzSeasons does not swallow them. +Exceptions thrown from `onRegister` or `onUnregister` propagate to the caller; EzSeasons does not swallow them. --- ## Events +> **Note:** Event classes (`SeasonResetEvent`, `SeasonsIntegrationRegisteredEvent`, `SeasonsIntegrationUnregisteredEvent`) are shipped in the **plugin JAR**, not in the API artifact. If your plugin uses `@EventHandler` listeners directly, declare EzSeasons as a `softdepend` and add the plugin JAR as a `provided` compile dependency. For most integrations the `onSeasonReset` callback on `SeasonsIntegration` is sufficient and requires only the API artifact. + ### `SeasonResetEvent` Fired whenever EzSeasons performs a season reset (scheduled or forced). Fired **after** timestamps are updated and persisted. diff --git a/plugin/pom.xml b/plugin/pom.xml index 5ffe647..ccfa8ae 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -6,7 +6,7 @@ com.skyblockexp.lifesteal ezseasons-parent - 2.0.3 + 2.1.0 ezseasons-plugin diff --git a/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/EzSeasonsPlugin.java b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/EzSeasonsPlugin.java index 7b4ec97..52246a3 100644 --- a/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/EzSeasonsPlugin.java +++ b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/EzSeasonsPlugin.java @@ -45,4 +45,8 @@ public MessageService getMessageService() { public SeasonManager getSeasonManager() { return registry.getSeasonManager(); } + + public SeasonsApiImpl getSeasonsApi() { + return registry.getSeasonsApi(); + } } diff --git a/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/SeasonManager.java b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/SeasonManager.java index c3367fb..7119250 100644 --- a/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/SeasonManager.java +++ b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/SeasonManager.java @@ -84,6 +84,13 @@ public synchronized void triggerSeasonReset(String reason) { if (Bukkit.getServer() != null) { Bukkit.getPluginManager().callEvent(new SeasonResetEvent(previousReset, resetAt, nextResetMillis, reason)); } + final SeasonsApiImpl api = plugin != null ? plugin.getSeasonsApi() : null; + if (api != null) { + for (com.skyblockexp.lifesteal.seasons.api.SeasonsIntegration integration : api.getIntegrations()) { + integration.onSeasonReset(previousReset, resetAt, nextResetMillis, + reason != null ? reason : "unspecified"); + } + } if (broadcastMessage != null && !broadcastMessage.isBlank() && Bukkit.getServer() != null) { Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', broadcastMessage)); } diff --git a/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonResetEvent.java b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonResetEvent.java similarity index 100% rename from api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonResetEvent.java rename to plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonResetEvent.java diff --git a/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationRegisteredEvent.java b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationRegisteredEvent.java similarity index 100% rename from api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationRegisteredEvent.java rename to plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationRegisteredEvent.java diff --git a/api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationUnregisteredEvent.java b/plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationUnregisteredEvent.java similarity index 100% rename from api/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationUnregisteredEvent.java rename to plugin/src/main/java/com/skyblockexp/lifesteal/seasons/api/events/SeasonsIntegrationUnregisteredEvent.java diff --git a/pom.xml b/pom.xml index 3f7fb21..e54d997 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.skyblockexp.lifesteal ezseasons-parent - 2.0.3 + 2.1.0 pom EzSeasons