49 Commits

Author SHA1 Message Date
89fa19d9ad Update s4u/setup-maven-action action to v1.15.0 2024-10-05 17:01:40 +00:00
Lee
acd87f9741 Merge pull request 'Update dependency org.springframework:spring-web to v6.1.13' (#16) from renovate/spring-core into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 31s
Reviewed-on: #16
2024-09-25 23:50:32 +00:00
Lee
7a482a2b7f Merge pull request 'Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.4' (#17) from renovate/org.apache.httpcomponents.client5-httpclient5-5.x into master
Some checks are pending
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Waiting to run
Reviewed-on: #17
2024-09-25 23:50:22 +00:00
Lee
9ce3f867d4 Merge pull request 'Update junit5 monorepo to v5.11.1' (#15) from renovate/junit5-monorepo into master
Some checks are pending
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Waiting to run
Reviewed-on: #15
2024-09-25 23:50:10 +00:00
5af9d1099e Update junit5 monorepo to v5.11.1 2024-09-25 08:01:23 +00:00
abac8f6b57 Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.4 2024-09-19 17:01:44 +00:00
94b9df0ec8 Update dependency org.springframework:spring-web to v6.1.13 2024-09-12 12:01:29 +00:00
Lee
44a216c928 Merge pull request 'Update dependency org.springframework:spring-web to v6.1.11' (#14) from renovate/spring-core into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 27s
Reviewed-on: #14
2024-07-30 20:55:48 +00:00
3eec5d30a6 Update dependency org.springframework:spring-web to v6.1.11 2024-07-11 09:00:56 +00:00
fe2e19f953 oopsie
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 18s
2024-07-06 05:08:55 +01:00
190c41ba90 Merge remote-tracking branch 'origin/master'
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 20s
2024-07-06 05:02:11 +01:00
3c7ba27953 fix? 2024-07-06 05:02:05 +01:00
Lee
24770bf2a9 Merge pull request 'Update dependency org.springframework:spring-web to v6.1.10' (#8) from renovate/spring-core into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m53s
Reviewed-on: #8
2024-07-06 03:39:14 +00:00
Lee
50573fed45 Merge pull request 'Update s4u/setup-maven-action action to v1.14.0' (#9) from renovate/s4u-setup-maven-action-1.x into master
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Reviewed-on: #9
2024-07-06 03:39:07 +00:00
Lee
805c09d31d Merge pull request 'Update dependency com.google.code.gson:gson to v2.11.0' (#10) from renovate/com.google.code.gson-gson-2.x into master
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Reviewed-on: #10
2024-07-06 03:39:00 +00:00
Lee
04d8e66e3b Merge pull request 'Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.0' (#11) from renovate/org.apache.maven.plugins-maven-shade-plugin-3.x into master
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Reviewed-on: #11
2024-07-06 03:38:54 +00:00
Lee
cf143e10a3 Merge pull request 'Update junit5 monorepo to v5.10.3' (#12) from renovate/junit5-monorepo into master
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Reviewed-on: #12
2024-07-06 03:38:38 +00:00
Lee
4628c8f23b Merge pull request 'Update dependency org.projectlombok:lombok to v1.18.34' (#13) from renovate/org.projectlombok-lombok-1.x into master
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Reviewed-on: #13
2024-07-06 03:38:32 +00:00
0ae5b94124 Update s4u/setup-maven-action action to v1.14.0 2024-06-29 08:00:55 +00:00
3a696ebd1e Update dependency org.projectlombok:lombok to v1.18.34 2024-06-28 01:00:55 +00:00
bfe20bc87c Update junit5 monorepo to v5.10.3 2024-06-27 15:00:49 +00:00
5f4722e079 Update dependency org.springframework:spring-web to v6.1.10 2024-06-19 17:00:53 +00:00
1c19098c87 Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.0 2024-05-31 09:01:47 +00:00
de71477c98 Update dependency com.google.code.gson:gson to v2.11.0 2024-05-19 20:01:43 +00:00
Lee
0abef68e86 Merge pull request 'Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.3' (#7) from renovate/org.apache.maven.plugins-maven-shade-plugin-3.x into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 48s
Reviewed-on: #7
2024-04-23 20:01:50 +00:00
6f34a25d65 Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.3 2024-04-23 20:00:57 +00:00
10ff006eb4 add preview to the motd class
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 27s
2024-04-22 20:22:24 +01:00
24b0a767be Merge remote-tracking branch 'origin/master'
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 23s
2024-04-21 23:37:48 +01:00
21c93f45b8 bump ver 2024-04-21 23:34:40 +01:00
579aa64094 add location to the server 2024-04-21 23:29:25 +01:00
Lee
dc8e8c62f0 Update README.md 2024-04-21 12:51:08 +00:00
97a77a3af9 Merge remote-tracking branch 'origin/master'
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 21s
2024-04-20 21:12:41 +01:00
ecd328aa48 add server previews 2024-04-20 21:12:35 +01:00
Lee
e5c15d4590 Update README.md 2024-04-20 01:12:59 +00:00
Lee
9f7b89a06e Update README.md 2024-04-19 22:16:19 +00:00
39cb7e3d81 Merge remote-tracking branch 'origin/master'
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 24s
2024-04-19 17:27:15 +01:00
034f686e08 use new mojang endpoint status model 2024-04-19 17:25:46 +01:00
Lee
8f6311d59f Merge pull request 'Configure Renovate' (#5) from renovate/configure into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 18s
Reviewed-on: #5
2024-04-18 20:17:06 +00:00
e23fb11d45 Add renovate.json 2024-04-18 20:16:32 +00:00
Lee
c5e0b3ec62 Delete renovate.json
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 19s
2024-04-18 20:13:39 +00:00
Lee
d22c169c26 Merge pull request 'Configure Renovate' (#4) from renovate/configure into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 24s
Reviewed-on: #4
2024-04-18 11:02:38 +00:00
63eae31267 Add renovate.json 2024-04-18 11:02:15 +00:00
Lee
88d47e854f Delete renovate.json
Some checks failed
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
2024-04-18 11:01:38 +00:00
Lee
f9c7c8bb44 Merge pull request 'Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.3.1' (#2) from renovate/org.apache.httpcomponents.client5-httpclient5-5.x into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m4s
Reviewed-on: #2
2024-04-18 08:42:05 +00:00
Lee
806c28303f Merge pull request 'Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.2' (#3) from renovate/org.apache.maven.plugins-maven-shade-plugin-3.x into master
Some checks are pending
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Waiting to run
Reviewed-on: #3
2024-04-18 08:41:53 +00:00
54fc250d3a Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.2 2024-04-18 08:41:19 +00:00
467b45c601 Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.3.1 2024-04-18 08:41:17 +00:00
Lee
dbd1bbaad0 Merge pull request 'Configure Renovate' (#1) from renovate/configure into master
All checks were successful
Publish package to my Maven Repository / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 30s
Reviewed-on: #1
2024-04-18 08:37:12 +00:00
011be87469 Add renovate.json 2024-04-18 08:34:11 +00:00
18 changed files with 176 additions and 73 deletions

View File

@ -23,7 +23,7 @@ jobs:
# Setup Java and Maven
- name: Set up JDK and Maven
uses: s4u/setup-maven-action@v1.12.0
uses: s4u/setup-maven-action@v1.15.0
with:
java-version: ${{ matrix.java-version }}
distribution: "zulu"

View File

@ -1,35 +1,3 @@
# Minecraft Utilities - Java Library
The Java library for the Minecraft Utilities API.
## Usage
Maven:
```xml
<repositories>
<repository>
<id>fascinated-repo-public</id>
<name>Fascinated's Repository</name>
<url>https://repo.fascinated.cc/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>xyz.mcutils</groupId>
<artifactId>mcutils-java-library</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
```
Usage:
```java
public class Main {
public static void main(String[] args) {
System.out.println(McUtilsAPI.getPlayer("Notch"));
}
}
```
See [The Website](https://mcutils.xyz) or [Minecraft Utilities Documentation](https://mcutils.xyz/docs) for more information.

16
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>xyz.mcutils</groupId>
<artifactId>mcutils-java-library</artifactId>
<version>1.1</version>
<version>1.2.4</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
@ -28,7 +28,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
@ -46,13 +46,13 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
@ -60,13 +60,13 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>6.1.6</version>
<version>6.1.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3</version>
<version>5.4</version>
<scope>compile</scope>
</dependency>
@ -74,13 +74,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.2</version>
<version>5.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<version>5.11.1</version>
<scope>test</scope>
</dependency>
</dependencies>

6
renovate.json Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

View File

@ -2,10 +2,8 @@ package xyz.mcutils;
import xyz.mcutils.common.WebRequest;
import xyz.mcutils.exception.ErrorResponse;
import xyz.mcutils.models.mojang.CachedMojangEndpointStatus;
import xyz.mcutils.models.player.CachedPlayer;
import xyz.mcutils.models.player.CachedPlayerSkinPart;
import xyz.mcutils.models.player.CachedUsernameToUuid;
import xyz.mcutils.models.cache.*;
import xyz.mcutils.models.cache.CachedPlayerSkinPart;
import xyz.mcutils.models.player.Skin;
import xyz.mcutils.models.server.*;
@ -17,6 +15,7 @@ public class McUtilsAPI {
private static final String PLAYER_SKIN_PART_ENDPOINT = API_ENDPOINT + "/player/%s/%s";
private static final String SERVER_ENDPOINT = API_ENDPOINT + "/server/%s/%s";
private static final String SERVER_ICON_ENDPOINT = API_ENDPOINT + "/server/icon/%s";
private static final String SERVER_PREVIEW_ENDPOINT = API_ENDPOINT + "/server/%s/preview/%s";
private static final String SERVER_BLOCKED_STATUS_ENDPOINT = API_ENDPOINT + "/server/blocked/%s";
/**
@ -109,4 +108,16 @@ public class McUtilsAPI {
public static CachedServerBlockedStatus getServerBlockedStatus(String id) throws ErrorResponse {
return WebRequest.get(SERVER_BLOCKED_STATUS_ENDPOINT.formatted(id), CachedServerBlockedStatus.class);
}
/**
* Gets the icon of a Java server from the API.
*
* @param id The id of the server to get the icon of.
* @return The server icon.
* @throws ErrorResponse If an error occurs.
*/
public static CachedServerPreview getServerPreview(ServerPlatform platform, String id) throws ErrorResponse {
byte[] bytes = WebRequest.get(SERVER_PREVIEW_ENDPOINT.formatted(platform.name(), id), byte[].class);
return new CachedServerPreview(bytes);
}
}

View File

@ -1,7 +1,8 @@
package xyz.mcutils.models.server;
package xyz.mcutils.models.cache;
import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.server.MinecraftServer;
@Getter
public class CachedBedrockMinecraftServer extends MinecraftServer {

View File

@ -1,7 +1,8 @@
package xyz.mcutils.models.server;
package xyz.mcutils.models.cache;
import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.server.MinecraftServer;
@Getter
public class CachedJavaMinecraftServer extends MinecraftServer {

View File

@ -0,0 +1,17 @@
package xyz.mcutils.models.cache;
import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.CachedResponse;
import xyz.mcutils.models.mojang.EndpointStatus;
import java.util.List;
@Getter @ToString
public class CachedMojangEndpointStatus extends CachedResponse {
/**
* The list of endpoints and their status.
*/
private List<EndpointStatus> endpoints;
}

View File

@ -1,8 +1,10 @@
package xyz.mcutils.models.player;
package xyz.mcutils.models.cache;
import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.CachedResponse;
import xyz.mcutils.models.player.Cape;
import xyz.mcutils.models.player.Skin;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package xyz.mcutils.models.player;
package xyz.mcutils.models.cache;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -1,4 +1,4 @@
package xyz.mcutils.models.server;
package xyz.mcutils.models.cache;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -0,0 +1,13 @@
package xyz.mcutils.models.cache;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
@AllArgsConstructor @Getter @ToString
public class CachedServerPreview {
/**
* The bytes for the skin part
*/
private byte[] bytes;
}

View File

@ -1,4 +1,4 @@
package xyz.mcutils.models.player;
package xyz.mcutils.models.cache;
import lombok.Getter;
import lombok.ToString;

View File

@ -1,21 +1,28 @@
package xyz.mcutils.models.mojang;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.CachedResponse;
import java.util.Map;
@AllArgsConstructor
@Getter @ToString
public class CachedMojangEndpointStatus extends CachedResponse {
@Getter
public class EndpointStatus {
/**
* The list of endpoints and their status.
* The name of the service.
*/
private Map<String, Status> endpoints;
private String name;
/**
* The hostname of the service.
*/
private String hostname;
/**
* The status of the service.
*/
private Status status;
/**
* Statuses for the endpoint.
*/
public enum Status {
/**
* The service is online and operational.
@ -33,4 +40,4 @@ public class CachedMojangEndpointStatus extends CachedResponse {
*/
OFFLINE
}
}
}

View File

@ -39,8 +39,13 @@ public class MinecraftServer {
*/
private Players players;
@AllArgsConstructor @Getter
private static class MOTD {
/**
* The location of the server.
*/
private GeoLocation location;
@Getter
public static class MOTD {
/**
* The raw motd lines
@ -56,13 +61,18 @@ public class MinecraftServer {
* The html motd lines
*/
private String[] html;
/**
* The server list MOTD preview.
*/
private String preview;
}
/**
* Player count data for a server.
*/
@Getter
private static class Players {
public static class Players {
/**
* The online players on this server.
*/
@ -94,4 +104,35 @@ public class MinecraftServer {
private String name;
}
}
/**
* The location of the server.
*/
@Getter
public static class GeoLocation {
/**
* The country of the server.
*/
private String country;
/**
* The region of the server.
*/
private String region;
/**
* The city of the server.
*/
private String city;
/**
* The latitude of the server.
*/
private double latitude;
/**
* The longitude of the server.
*/
private double longitude;
}
}

View File

@ -2,7 +2,7 @@ package xyz.mcutils;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import xyz.mcutils.models.mojang.CachedMojangEndpointStatus;
import xyz.mcutils.models.cache.CachedMojangEndpointStatus;
public class MojangTests {

View File

@ -3,9 +3,9 @@ package xyz.mcutils;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import xyz.mcutils.exception.ErrorResponse;
import xyz.mcutils.models.player.CachedPlayer;
import xyz.mcutils.models.player.CachedPlayerSkinPart;
import xyz.mcutils.models.player.CachedUsernameToUuid;
import xyz.mcutils.models.cache.CachedPlayer;
import xyz.mcutils.models.cache.CachedPlayerSkinPart;
import xyz.mcutils.models.cache.CachedUsernameToUuid;
import xyz.mcutils.models.player.Skin;
public class PlayerTests {

View File

@ -3,10 +3,12 @@ package xyz.mcutils;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import xyz.mcutils.exception.ErrorResponse;
import xyz.mcutils.models.server.CachedBedrockMinecraftServer;
import xyz.mcutils.models.server.CachedJavaMinecraftServer;
import xyz.mcutils.models.server.CachedServerBlockedStatus;
import xyz.mcutils.models.cache.CachedBedrockMinecraftServer;
import xyz.mcutils.models.cache.CachedJavaMinecraftServer;
import xyz.mcutils.models.cache.CachedServerBlockedStatus;
import xyz.mcutils.models.cache.CachedServerPreview;
import xyz.mcutils.models.server.CachedServerIcon;
import xyz.mcutils.models.server.ServerPlatform;
public class ServerTests {
@ -71,4 +73,38 @@ public class ServerTests {
assert ex.getCode() == 400;
}
}
@Test
@SneakyThrows
public void ensureBedrockServerIconLookupSuccess() {
CachedServerIcon icon = McUtilsAPI.getServerIcon(testBedrockServer);
assert icon.getBytes() != null;
}
@Test
@SneakyThrows
public void ensureBedrockServerIconLookupFailure() {
try {
McUtilsAPI.getServerIcon(testInvalidServer);
} catch (ErrorResponse ex) {
assert ex.getCode() == 400;
}
}
@Test
@SneakyThrows
public void ensureServerPreviewLookupSuccess() {
CachedServerPreview icon = McUtilsAPI.getServerPreview(ServerPlatform.JAVA, testJavaServer);
assert icon.getBytes() != null;
}
@Test
@SneakyThrows
public void ensureServerPreviewLookupFailure() {
try {
McUtilsAPI.getServerPreview(ServerPlatform.JAVA, testInvalidServer);
} catch (ErrorResponse ex) {
assert ex.getCode() == 400;
}
}
}