Add SCOPENET developer API and plugin compatibility layer (LuckPerms, PlaceholderAPI, Vault, CoreProtect, WorldGuard, Spark)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DjMbLQujBHunCCu5GpsHaT
This commit is contained in:
38 files changed
+2185
-4
No files matched your search
@@ -19,6 +19,7 @@ public final class Integration implements AutoCloseable {
|
||||
new ArrayBlockingQueue<>(64), r -> daemon(r, "scopenet-login"), new ThreadPoolExecutor.AbortPolicy());
|
||||
private final AtomicBoolean syncing = new AtomicBoolean();
|
||||
private volatile boolean closed;
|
||||
private volatile Consumer<JsonArray> notificationHandler;
|
||||
private volatile LiveMapSync liveMap;
|
||||
private boolean registered;
|
||||
private JsonObject pending;
|
||||
@@ -106,6 +107,12 @@ public final class Integration implements AutoCloseable {
|
||||
if (!response.has("ok") || !response.get("ok").getAsBoolean() || !response.has("kick")
|
||||
|| !response.get("kick").isJsonArray()) throw new IllegalStateException("Invalid sync response");
|
||||
pending = null;
|
||||
Consumer<JsonArray> handler = notificationHandler;
|
||||
if (handler != null && response.has("notifications") && response.get("notifications").isJsonArray()
|
||||
&& response.getAsJsonArray("notifications").size() > 0) {
|
||||
try { handler.accept(response.getAsJsonArray("notifications")); }
|
||||
catch (RuntimeException e) { log.accept("SCOPENET could not process panel events: " + e.getMessage()); }
|
||||
}
|
||||
for (JsonElement element : response.getAsJsonArray("kick")) {
|
||||
try {
|
||||
JsonObject entry = element.getAsJsonObject();
|
||||
@@ -129,6 +136,14 @@ public final class Integration implements AutoCloseable {
|
||||
return client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive events the panel queued for this server (level-ups, achievements,
|
||||
* guild changes) with each sync. Called on the sync worker thread.
|
||||
*/
|
||||
public void onNotifications(Consumer<JsonArray> handler) {
|
||||
this.notificationHandler = handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start mirroring this server's world and player positions to the panel's
|
||||
* central live map. {@code worldRoot} is the level folder (e.g. {@code world}).
|
||||
|
||||
Reference in new issue
Block a user