diff --git a/pom.xml b/pom.xml
index 677cdfd..762a83e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,14 +64,6 @@
org.springframework.boot
spring-boot-starter-web
-
-
-
-
- org.springframework.boot
- spring-boot-starter-json
-
-
diff --git a/src/main/java/me/braydon/mc/RESTfulMC.java b/src/main/java/me/braydon/mc/RESTfulMC.java
index 413d2d1..b6c6f61 100644
--- a/src/main/java/me/braydon/mc/RESTfulMC.java
+++ b/src/main/java/me/braydon/mc/RESTfulMC.java
@@ -28,7 +28,6 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import java.io.File;
import java.nio.file.Files;
@@ -38,7 +37,7 @@ import java.util.Objects;
/**
* @author Braydon
*/
-@SpringBootApplication(exclude = { JacksonAutoConfiguration.class })
+@SpringBootApplication
@Slf4j(topic = "RESTfulMC")
public class RESTfulMC {
@SneakyThrows
diff --git a/src/main/java/me/braydon/mc/config/AppConfig.java b/src/main/java/me/braydon/mc/config/AppConfig.java
index 34e7e15..4631a22 100644
--- a/src/main/java/me/braydon/mc/config/AppConfig.java
+++ b/src/main/java/me/braydon/mc/config/AppConfig.java
@@ -38,11 +38,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.info.BuildProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.GsonHttpMessageConverter;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import java.util.List;
/**
* The configuration for the app.
@@ -50,7 +45,7 @@ import java.util.List;
* @author Braydon
*/
@Configuration @Getter
-public class AppConfig implements WebMvcConfigurer {
+public class AppConfig {
public static AppConfig INSTANCE;
public static final Gson GSON = new GsonBuilder()
.setDateFormat("MM-dd-yyyy HH:mm:ss")
@@ -93,27 +88,4 @@ public class AppConfig implements WebMvcConfigurer {
.info(info)
.addServersItem(new Server().url(serverPublicUrl).description("The public server URL"));
}
-
- /**
- * Configure the default HTTP
- * message converters to use Gson.
- *
- * @param converters the converters
- */
- @Override
- public void configureMessageConverters(@NonNull List> converters) {
- GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
- gsonHttpMessageConverter.setGson(gson());
- converters.add(gsonHttpMessageConverter);
- }
-
- /**
- * Our custom Gson instance to use.
- *
- * @return the Gson instance
- */
- @Bean @NonNull
- public Gson gson() {
- return GSON;
- }
}
\ No newline at end of file
diff --git a/src/main/java/me/braydon/mc/model/MinecraftServer.java b/src/main/java/me/braydon/mc/model/MinecraftServer.java
index d999feb..1f463b7 100644
--- a/src/main/java/me/braydon/mc/model/MinecraftServer.java
+++ b/src/main/java/me/braydon/mc/model/MinecraftServer.java
@@ -23,6 +23,7 @@
*/
package me.braydon.mc.model;
+import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import me.braydon.mc.common.ColorUtils;
import me.braydon.mc.service.pinger.MinecraftServerPinger;
@@ -67,7 +68,7 @@ public class MinecraftServer {
/**
* Player count data for a server.
*/
- @AllArgsConstructor @Getter @ToString
+ @AllArgsConstructor @Getter @ToString @JsonInclude(JsonInclude.Include.NON_NULL)
public static class Players {
/**
* The online players on this server.
diff --git a/src/main/java/me/braydon/mc/model/Player.java b/src/main/java/me/braydon/mc/model/Player.java
index 6ac8c68..93d9d3a 100644
--- a/src/main/java/me/braydon/mc/model/Player.java
+++ b/src/main/java/me/braydon/mc/model/Player.java
@@ -23,6 +23,7 @@
*/
package me.braydon.mc.model;
+import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import org.springframework.data.annotation.Id;
@@ -35,7 +36,7 @@ import java.util.UUID;
*/
@AllArgsConstructor @Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
-@ToString
+@ToString @JsonInclude(JsonInclude.Include.NON_NULL)
public class Player {
/**
* The unique id of this player.
diff --git a/src/main/java/me/braydon/mc/model/Skin.java b/src/main/java/me/braydon/mc/model/Skin.java
index 88b5f05..5fcd563 100644
--- a/src/main/java/me/braydon/mc/model/Skin.java
+++ b/src/main/java/me/braydon/mc/model/Skin.java
@@ -101,7 +101,11 @@ public final class Skin {
*/
@AllArgsConstructor @Getter @ToString
public enum Part {
- HEAD(8, 8, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8);
+ HEAD_TOP(8, 0, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8),
+ FACE(8, 8, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8),
+ HEAD_LEFT(0, 8, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8),
+ HEAD_RIGHT(16, 8, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8),
+ HEAD_BOTTOM(8, 8, ImageUtils.SKIN_TEXTURE_SIZE / 8, ImageUtils.SKIN_TEXTURE_SIZE / 8);
/**
* The coordinates of this part.
diff --git a/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java b/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java
index 5051e67..1148e14 100644
--- a/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java
+++ b/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java
@@ -23,6 +23,7 @@
*/
package me.braydon.mc.model.cache;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import me.braydon.mc.model.MinecraftServer;
import org.springframework.data.annotation.Id;
@@ -39,7 +40,7 @@ public final class CachedMinecraftServer implements Serializable {
/**
* The id of this cached server.
*/
- @Id @NonNull private transient final String id;
+ @Id @JsonIgnore @NonNull private final String id;
/**
* The cached server.
diff --git a/src/main/java/me/braydon/mc/model/server/BedrockMinecraftServer.java b/src/main/java/me/braydon/mc/model/server/BedrockMinecraftServer.java
index 0444660..7052e71 100644
--- a/src/main/java/me/braydon/mc/model/server/BedrockMinecraftServer.java
+++ b/src/main/java/me/braydon/mc/model/server/BedrockMinecraftServer.java
@@ -34,9 +34,9 @@ import me.braydon.mc.model.MinecraftServer;
@Getter @ToString(callSuper = true) @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
public final class BedrockMinecraftServer extends MinecraftServer {
/**
- * The unique ID of this server.
+ * The ID of this server.
*/
- @EqualsAndHashCode.Include @NonNull private final String uniqueId;
+ @EqualsAndHashCode.Include @NonNull private final String id;
/**
* The edition of this server.
@@ -53,11 +53,11 @@ public final class BedrockMinecraftServer extends MinecraftServer {
*/
@NonNull private final GameMode gamemode;
- private BedrockMinecraftServer(@NonNull String uniqueId, @NonNull String hostname, String ip, int port,
+ private BedrockMinecraftServer(@NonNull String id, @NonNull String hostname, String ip, int port,
@NonNull Edition edition, @NonNull Version version, @NonNull Players players,
@NonNull MOTD motd, @NonNull GameMode gamemode) {
super(hostname, ip, port, players, motd);
- this.uniqueId = uniqueId;
+ this.id = id;
this.edition = edition;
this.version = version;
this.gamemode = gamemode;
diff --git a/src/main/java/me/braydon/mc/model/server/JavaMinecraftServer.java b/src/main/java/me/braydon/mc/model/server/JavaMinecraftServer.java
index e88e713..8d8ea74 100644
--- a/src/main/java/me/braydon/mc/model/server/JavaMinecraftServer.java
+++ b/src/main/java/me/braydon/mc/model/server/JavaMinecraftServer.java
@@ -23,6 +23,7 @@
*/
package me.braydon.mc.model.server;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.annotations.SerializedName;
import lombok.*;
import me.braydon.mc.common.JavaMinecraftVersion;
@@ -38,7 +39,7 @@ import net.md_5.bungee.chat.ComponentSerializer;
*
* @author Braydon
*/
-@Setter @Getter @ToString(callSuper = true)
+@Setter @Getter @ToString(callSuper = true) @JsonInclude(JsonInclude.Include.NON_NULL)
public final class JavaMinecraftServer extends MinecraftServer {
/**
* The version information of this server.
@@ -114,7 +115,7 @@ public final class JavaMinecraftServer extends MinecraftServer {
/**
* Version information for a server.
*/
- @AllArgsConstructor @Getter @ToString
+ @AllArgsConstructor @Getter @ToString @JsonInclude(JsonInclude.Include.NON_NULL)
public static class Version {
/**
* The version name of the server.
diff --git a/src/main/java/me/braydon/mc/service/MojangService.java b/src/main/java/me/braydon/mc/service/MojangService.java
index 40f80f9..550ee6d 100644
--- a/src/main/java/me/braydon/mc/service/MojangService.java
+++ b/src/main/java/me/braydon/mc/service/MojangService.java
@@ -169,7 +169,7 @@ public final class MojangService {
}
Skin.Part part = EnumUtils.getEnumConstant(Skin.Part.class, partName.toUpperCase()); // The skin part to get
if (part == null) { // Default to the head part
- part = Skin.Part.HEAD;
+ part = Skin.Part.FACE;
}
if (extension.isBlank()) { // Invalid extension
throw new BadRequestException("Invalid extension");