File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
src/main/java/com/exaroton/api Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,13 @@ that can be used to automatically manage Minecraft servers (e.g. starting or sto
77
88Required Java Version: 8+
99
10- If you're creating a plugin/mod that runs on an exaroton server, you can use the environment variable
11- EXAROTON_SERVER_ID to find the ID of the server it's running on.
10+ If you're creating a plugin/mod that runs on an exaroton server, you can get the current server using client.getCurrentServer().
1211
1312### Installing
1413Gradle:
1514``` gradle
1615dependencies {
17- implementation 'com.exaroton:api:1.1.2 '
16+ implementation 'com.exaroton:api:1.2.0 '
1817}
1918```
2019
2322<dependency >
2423 <groupId >com.exaroton</groupId >
2524 <artifactId >api</artifactId >
26- <version >1.1.2 </version >
25+ <version >1.2.0 </version >
2726</dependency >
2827```
2928
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ plugins {
55}
66
77group ' com.exaroton'
8- version ' 1.1.2 '
8+ version ' 1.2.0 '
99
1010sourceSets {
1111 main {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public class ExarotonClient {
3434 /**
3535 * API user agent
3636 */
37- private String userAgent = "java-exaroton-api@1.1.2 " ;
37+ private String userAgent = "java-exaroton-api@1.2.0 " ;
3838
3939 /**
4040 * exaroton API token
@@ -198,4 +198,15 @@ public Server[] getServers() throws APIException {
198198 public Server getServer (String id ) {
199199 return new Server (this , id );
200200 }
201+
202+ /**
203+ * Get the current exaroton server using the EXAROTON_SERVER_ID environment variable.
204+ * If the environment variable is not set returns null
205+ * @return the exaroton server running this code
206+ */
207+ public Server getCurrentServer () {
208+ String id = System .getenv ("EXAROTON_SERVER_ID" );
209+ if (id == null ) return null ;
210+ return this .getServer (id );
211+ }
201212}
You can’t perform that action at this time.
0 commit comments