Getters for fields in HandshakeData

This commit is contained in:
thiccaxe 2021-04-11 10:46:09 -07:00
parent c451d46ce0
commit fadbe39494
2 changed files with 61 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import net.minestom.server.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@ -54,6 +55,14 @@ public class ResponseData {
this.version = version;
}
/**
* Get the version name for the response.
* @return the version name for the response.
*/
public String getVersion() {
return version;
}
/**
* Sets the response protocol version.
*
@ -63,6 +72,13 @@ public class ResponseData {
this.protocol = protocol;
}
/**
* Get the response protocol version.
* @return the response protocol version.
*/
public int getProtocol() {
return protocol;
}
/**
* Sets the response maximum player count.
*
@ -72,6 +88,13 @@ public class ResponseData {
this.maxPlayer = maxPlayer;
}
/**
* Get the response maximum player count.
* @return the response maximum player count.
*/
public int getMaxPlayer() {
return maxPlayer;
}
/**
* Sets the response online count.
*
@ -81,6 +104,15 @@ public class ResponseData {
this.online = online;
}
/**
* Get the response online count.
*
* @return the response online count.
*/
public int getOnline() {
return online;
}
/**
* Adds some players to the response.
*
@ -136,6 +168,14 @@ public class ResponseData {
this.pingPlayers.clear();
}
/**
* Get the list of the response players.
* @return the list of the response players.
*/
public List<PingPlayer> getPlayers() {
return pingPlayers;
}
/**
* Sets the response description.
*
@ -156,6 +196,15 @@ public class ResponseData {
this.description = description;
}
/**
* Get the response description
*
* @return the response description
*/
public Component getDescription() {
return description;
}
/**
* Sets the response favicon.
*
@ -167,6 +216,15 @@ public class ResponseData {
this.favicon = favicon;
}
/**
* Get the response favicon.
* @return the response favicon.
*/
public String getFavicon() {
return favicon;
}
/**
* Converts the response data into a {@link JsonObject}.
*
@ -208,8 +266,8 @@ public class ResponseData {
/**
* Represents a player line in the server list hover.
*/
private static class PingPlayer {
private String name;
private UUID uuid;
public static class PingPlayer {
public String name;
public UUID uuid;
}
}

View File

@ -98,7 +98,6 @@ public class Main {
});
PlayerInit.init();