diff options
6 files changed, 12 insertions, 15 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java index c65bc23..28b7475 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java @@ -44,7 +44,8 @@ import java.util.Map; /** * Utility for interacting with the server's {@link CommandMap} instance. */ -final class CommandMapUtil { +enum CommandMapUtil { + ; private static final Constructor<PluginCommand> COMMAND_CONSTRUCTOR; private static final Field COMMAND_MAP_FIELD; @@ -145,8 +146,4 @@ final class CommandMapUtil { return command; } - private CommandMapUtil() { - throw new UnsupportedOperationException("This class cannot be instantiated"); - } - }
\ No newline at end of file diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java index 86ab047..0737a00 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java @@ -256,7 +256,7 @@ public class HealthModule implements CommandModule { ); } - private static TextComponent formatTps(double tps) { + public static TextComponent formatTps(double tps) { TextColor color; if (tps > 18.0) { color = TextColor.GREEN; @@ -269,7 +269,7 @@ public class HealthModule implements CommandModule { return TextComponent.of( (tps > 20.0 ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0), color); } - private static TextComponent formatCpuUsage(double usage) { + public static TextComponent formatCpuUsage(double usage) { TextColor color; if (usage > 0.9) { color = TextColor.RED; diff --git a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDump.java b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDump.java index 189f89e..f2c1c72 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDump.java +++ b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDump.java @@ -31,9 +31,8 @@ import java.nio.file.Path; /** * Utility for creating .hprof memory heap snapshots. */ -public final class HeapDump { - - private HeapDump() {} +public enum HeapDump { + ; /** The object name of the com.sun.management.HotSpotDiagnosticMXBean */ private static final String DIAGNOSTIC_BEAN = "com.sun.management:type=HotSpotDiagnostic"; diff --git a/spark-common/src/main/java/me/lucko/spark/common/monitor/cpu/CpuMonitor.java b/spark-common/src/main/java/me/lucko/spark/common/monitor/cpu/CpuMonitor.java index f4190e5..cd451ed 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/monitor/cpu/CpuMonitor.java +++ b/spark-common/src/main/java/me/lucko/spark/common/monitor/cpu/CpuMonitor.java @@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit; /** * Exposes and monitors the system/process CPU usage. */ -public final class CpuMonitor { - private CpuMonitor() {} +public enum CpuMonitor { + ; /** The object name of the com.sun.management.OperatingSystemMXBean */ private static final String OPERATING_SYSTEM_BEAN = "java.lang:type=OperatingSystem"; diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/FormatUtil.java b/spark-common/src/main/java/me/lucko/spark/common/util/FormatUtil.java index 37165d1..8713678 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/util/FormatUtil.java +++ b/spark-common/src/main/java/me/lucko/spark/common/util/FormatUtil.java @@ -20,8 +20,8 @@ package me.lucko.spark.common.util; -public final class FormatUtil { - private FormatUtil() {} +public enum FormatUtil { + ; public static String percent(double value, double max) { double percent = (value * 100d) / max; diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/TypeDescriptors.java b/spark-common/src/main/java/me/lucko/spark/common/util/TypeDescriptors.java index a232e77..c827c69 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/util/TypeDescriptors.java +++ b/spark-common/src/main/java/me/lucko/spark/common/util/TypeDescriptors.java @@ -23,7 +23,8 @@ package me.lucko.spark.common.util; /** * Utilities for working with Java type descriptors. */ -public final class TypeDescriptors { +public enum TypeDescriptors { + ; /** * Returns the Java type corresponding to the given type descriptor. |