diff --git a/build.gradle b/build.gradle index a17ea96..e0b2746 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.izzel.arclight' -version '1.6.0' +version '1.6.1' repositories { mavenCentral() diff --git a/src/main/java/io/izzel/arclight/api/Arclight.java b/src/main/java/io/izzel/arclight/api/Arclight.java index 483d07d..dc6a647 100644 --- a/src/main/java/io/izzel/arclight/api/Arclight.java +++ b/src/main/java/io/izzel/arclight/api/Arclight.java @@ -41,7 +41,7 @@ public static TickingTracker getTickingTracker() { * @since 1.6.0 */ public static ArclightPlatform getPlatform() { - return getServer().getPlatform(); + return ArclightPlatform.current(); } private static ArclightServer getServer() { diff --git a/src/main/java/io/izzel/arclight/api/ArclightPlatform.java b/src/main/java/io/izzel/arclight/api/ArclightPlatform.java index 8f3dab7..1b114a7 100644 --- a/src/main/java/io/izzel/arclight/api/ArclightPlatform.java +++ b/src/main/java/io/izzel/arclight/api/ArclightPlatform.java @@ -6,5 +6,18 @@ public enum ArclightPlatform { VANILLA, FORGE, - NEOFORGE + NEOFORGE; + + private static ArclightPlatform platform; + + public static void setPlatform(ArclightPlatform platform) { + if (ArclightPlatform.platform != null) throw new IllegalStateException("Platform is already set!"); + if (platform == null) throw new IllegalArgumentException("Platform cannot be null!"); + ArclightPlatform.platform = platform; + } + + public static ArclightPlatform current() { + if (ArclightPlatform.platform == null) throw new IllegalStateException("Version is not set!"); + return platform; + } } diff --git a/src/main/java/io/izzel/arclight/api/ArclightServer.java b/src/main/java/io/izzel/arclight/api/ArclightServer.java index 2619667..c98f10d 100644 --- a/src/main/java/io/izzel/arclight/api/ArclightServer.java +++ b/src/main/java/io/izzel/arclight/api/ArclightServer.java @@ -22,10 +22,4 @@ default ArclightVersion getVersion() { * @see Arclight#getTickingTracker() */ TickingTracker getTickingTracker(); - - /** - * @return current platform - * @see Arclight#getPlatform() - */ - ArclightPlatform getPlatform(); }