Skip to content

Commit

Permalink
Platform api
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Feb 2, 2024
1 parent e27b79f commit 3b33f0d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'io.izzel.arclight'
version '1.6.0'
version '1.6.1'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/izzel/arclight/api/Arclight.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/io/izzel/arclight/api/ArclightPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
6 changes: 0 additions & 6 deletions src/main/java/io/izzel/arclight/api/ArclightServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,4 @@ default ArclightVersion getVersion() {
* @see Arclight#getTickingTracker()
*/
TickingTracker getTickingTracker();

/**
* @return current platform
* @see Arclight#getPlatform()
*/
ArclightPlatform getPlatform();
}

0 comments on commit 3b33f0d

Please sign in to comment.