Skip to content

Commit 382f32a

Browse files
committed
Add a way to get the name of the current platform.
1 parent 6afa5b4 commit 382f32a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Common/src/main/java/net/darkhax/bookshelf/api/util/IPlatformHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,11 @@ default MutableComponent getModNameComponent(String modId) {
111111
* @return Are game tests currently enabled?
112112
*/
113113
boolean isTestingEnvironment();
114+
115+
/**
116+
* Gets the name of the platform.
117+
*
118+
* @return The name of the platform.
119+
*/
120+
String getName();
114121
}

Fabric/src/main/java/net/darkhax/bookshelf/impl/util/PlatformHelperFabric.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,10 @@ public boolean isTestingEnvironment() {
5353

5454
return FabricGameTestHelper.ENABLED;
5555
}
56+
57+
@Override
58+
public String getName() {
59+
60+
return "Fabric";
61+
}
5662
}

Forge/src/main/java/net/darkhax/bookshelf/impl/util/PlatformHelperForge.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ public boolean isTestingEnvironment() {
5555

5656
return ForgeGameTestHooks.isGametestEnabled();
5757
}
58+
59+
@Override
60+
public String getName() {
61+
return "Forge";
62+
}
5863
}

0 commit comments

Comments
 (0)