add server banned status and blocked endpoint
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 21s
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 21s
This commit is contained in:
@ -24,7 +24,7 @@ public final class JavaServerStatusToken {
|
||||
/**
|
||||
* The motd of the server.
|
||||
*/
|
||||
private final String description;
|
||||
private final Object description;
|
||||
|
||||
/**
|
||||
* The favicon of the server.
|
||||
|
@ -1,11 +1,18 @@
|
||||
package cc.fascinated.model.server;
|
||||
|
||||
import cc.fascinated.Main;
|
||||
import cc.fascinated.common.JavaMinecraftVersion;
|
||||
import cc.fascinated.common.ServerUtils;
|
||||
import cc.fascinated.config.Config;
|
||||
import cc.fascinated.model.mojang.JavaServerStatusToken;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.chat.ComponentSerializer;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Braydon
|
||||
@ -28,6 +35,11 @@ public final class JavaMinecraftServer extends MinecraftServer {
|
||||
*/
|
||||
private Favicon favicon;
|
||||
|
||||
/**
|
||||
* The mojang banned status of the server.
|
||||
*/
|
||||
private boolean mojangBanned;
|
||||
|
||||
public JavaMinecraftServer(String hostname, String ip, int port, MOTD motd, @NonNull Version version, Players players, Favicon favicon) {
|
||||
super(hostname, ip, port, motd);
|
||||
this.version = version;
|
||||
@ -35,6 +47,32 @@ public final class JavaMinecraftServer extends MinecraftServer {
|
||||
this.favicon = favicon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Java Minecraft server.
|
||||
*
|
||||
* @param hostname the hostname of the server
|
||||
* @param ip the IP address of the server
|
||||
* @param port the port of the server
|
||||
* @param token the status token
|
||||
* @return the Java Minecraft server
|
||||
*/
|
||||
@NonNull
|
||||
public static JavaMinecraftServer create(@NonNull String hostname, String ip, int port, @NonNull JavaServerStatusToken token) {
|
||||
String motdString = token.getDescription() instanceof String ? (String) token.getDescription() : null;
|
||||
if (motdString == null) { // Not a string motd, convert from Json
|
||||
motdString = new TextComponent(ComponentSerializer.parse(Main.GSON.toJson(token.getDescription()))).toLegacyText();
|
||||
}
|
||||
return new JavaMinecraftServer(
|
||||
hostname,
|
||||
ip,
|
||||
port,
|
||||
MinecraftServer.MOTD.create(motdString),
|
||||
token.getVersion().detailedCopy(),
|
||||
token.getPlayers(),
|
||||
JavaMinecraftServer.Favicon.create(token.getFavicon(), ServerUtils.getAddress(hostname, port))
|
||||
);
|
||||
}
|
||||
|
||||
@AllArgsConstructor @Getter
|
||||
public static class Version {
|
||||
/**
|
||||
|
Reference in New Issue
Block a user