From 84fce987d5581ba6ec7bee281b785b980ba2d37c Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 22 Oct 2023 21:08:45 +0100 Subject: [PATCH] Change healthcheck details return type --- api/build.gradle | 21 ++++--------------- .../net/luckperms/api/platform/Health.java | 2 +- .../plugin/AbstractLuckPermsPlugin.java | 8 +++---- .../common/plugin/util/HealthCheckResult.java | 10 ++++----- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index c6270cc4d..63abdc9ef 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -27,7 +27,7 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass 'https://javadoc.io/static/org.jetbrains/annotations/23.0.0/' ) options.addStringOption('Xdoclint:none', '-quiet') - options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4') + options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4,5.5') if (JavaVersion.current() > JavaVersion.VERSION_1_8) { options.links.add('https://docs.oracle.com/en/java/javase/11/docs/api/') @@ -36,19 +36,9 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass } } - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier 'javadoc' - from javadoc.destinationDir - } - - task sourcesJar(type: Jar) { - classifier 'sources' - from sourceSets.main.allSource - } - - artifacts { - archives javadocJar - archives sourcesJar + java { + withJavadocJar() + withSourcesJar() } publishing { @@ -70,8 +60,6 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass artifactId = 'api' from components.java - artifact sourcesJar - artifact javadocJar pom { name = 'LuckPerms API' @@ -111,7 +99,6 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass signing { useGpgCmd() - sign configurations.archives sign publishing.publications.mavenJava required = true } diff --git a/api/src/main/java/net/luckperms/api/platform/Health.java b/api/src/main/java/net/luckperms/api/platform/Health.java index 7e7704f23..25ece4bee 100644 --- a/api/src/main/java/net/luckperms/api/platform/Health.java +++ b/api/src/main/java/net/luckperms/api/platform/Health.java @@ -46,6 +46,6 @@ public interface Health { * * @return details about the healthcheck status */ - Map getDetails(); + Map getDetails(); } diff --git a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java index f337a1dff..97a724d58 100644 --- a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java @@ -408,15 +408,15 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin { return HealthCheckResult.unhealthy(Collections.singletonMap("reason", "storage disconnected")); } - Map map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); if (meta.connected() != null) { - map.put("storageConnected", meta.connected().toString()); + map.put("storageConnected", meta.connected()); } if (meta.ping() != null) { - map.put("storagePing", meta.ping().toString()); + map.put("storagePing", meta.ping()); } if (meta.sizeBytes() != null) { - map.put("storageSizeBytes", meta.sizeBytes().toString()); + map.put("storageSizeBytes", meta.sizeBytes()); } return HealthCheckResult.healthy(map); diff --git a/common/src/main/java/me/lucko/luckperms/common/plugin/util/HealthCheckResult.java b/common/src/main/java/me/lucko/luckperms/common/plugin/util/HealthCheckResult.java index 5ea17a416..2b080ea96 100644 --- a/common/src/main/java/me/lucko/luckperms/common/plugin/util/HealthCheckResult.java +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/util/HealthCheckResult.java @@ -33,18 +33,18 @@ import java.util.Map; public class HealthCheckResult implements Health { private static final Gson GSON = new Gson(); - public static HealthCheckResult healthy(Map details) { + public static HealthCheckResult healthy(Map details) { return new HealthCheckResult(true, details); } - public static HealthCheckResult unhealthy(Map details) { + public static HealthCheckResult unhealthy(Map details) { return new HealthCheckResult(false, details); } private final boolean healthy; - private final Map details; + private final Map details; - HealthCheckResult(boolean healthy, Map details) { + HealthCheckResult(boolean healthy, Map details) { this.healthy = healthy; this.details = details; } @@ -55,7 +55,7 @@ public class HealthCheckResult implements Health { } @Override - public Map getDetails() { + public Map getDetails() { return this.details; }