use new mojang endpoint status model

This commit is contained in:
Lee 2024-04-19 17:25:46 +01:00
parent b0b45723b2
commit 034f686e08
12 changed files with 52 additions and 26 deletions

@ -6,7 +6,7 @@
<groupId>xyz.mcutils</groupId> <groupId>xyz.mcutils</groupId>
<artifactId>mcutils-java-library</artifactId> <artifactId>mcutils-java-library</artifactId>
<version>1.1</version> <version>1.1.1</version>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>

@ -2,10 +2,8 @@ package xyz.mcutils;
import xyz.mcutils.common.WebRequest; import xyz.mcutils.common.WebRequest;
import xyz.mcutils.exception.ErrorResponse; import xyz.mcutils.exception.ErrorResponse;
import xyz.mcutils.models.mojang.CachedMojangEndpointStatus; import xyz.mcutils.models.cache.*;
import xyz.mcutils.models.player.CachedPlayer;
import xyz.mcutils.models.player.CachedPlayerSkinPart; import xyz.mcutils.models.player.CachedPlayerSkinPart;
import xyz.mcutils.models.player.CachedUsernameToUuid;
import xyz.mcutils.models.player.Skin; import xyz.mcutils.models.player.Skin;
import xyz.mcutils.models.server.*; import xyz.mcutils.models.server.*;

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

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

@ -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;
}

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

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

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

@ -1,21 +1,28 @@
package xyz.mcutils.models.mojang; package xyz.mcutils.models.mojang;
import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.ToString;
import xyz.mcutils.models.CachedResponse;
import java.util.Map; @Getter
public class EndpointStatus {
@AllArgsConstructor
@Getter @ToString
public class CachedMojangEndpointStatus extends CachedResponse {
/** /**
* 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 { public enum Status {
/** /**
* The service is online and operational. * The service is online and operational.

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

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

@ -3,9 +3,9 @@ package xyz.mcutils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import xyz.mcutils.exception.ErrorResponse; import xyz.mcutils.exception.ErrorResponse;
import xyz.mcutils.models.server.CachedBedrockMinecraftServer; import xyz.mcutils.models.cache.CachedBedrockMinecraftServer;
import xyz.mcutils.models.server.CachedJavaMinecraftServer; import xyz.mcutils.models.cache.CachedJavaMinecraftServer;
import xyz.mcutils.models.server.CachedServerBlockedStatus; import xyz.mcutils.models.cache.CachedServerBlockedStatus;
import xyz.mcutils.models.server.CachedServerIcon; import xyz.mcutils.models.server.CachedServerIcon;
public class ServerTests { public class ServerTests {