Fixed client crashing when pinging with an older client

This commit is contained in:
themode 2020-11-09 03:21:18 +01:00
parent f9035bf949
commit e583f21b74
4 changed files with 10 additions and 6 deletions

View File

@ -441,9 +441,8 @@ public final class CommandManager {
List<DeclareCommandsPacket.Node> nodes = new ArrayList<>();
// You can uncomment this to test any brigadier parser on the client
/*DeclareCommandsPacket.Node testNode = simpleArgumentNode(nodes, argument, executable);
testNode.parser = "minecraft:entity";
testNode.properties = packetWriter -> packetWriter.writeByte((byte) 0x0);
/*DeclareCommandsPacket.Node testNode = simpleArgumentNode(nodes, argument, executable, false);
testNode.parser = "minecraft:item_predicate";
if (true) {
return nodes;

View File

@ -8,7 +8,7 @@ import java.util.Arrays;
/**
* Represents a single word in the command.
* <p>
* You can specify the only correct words with {@link #from(String...)}.
* You can specify the valid words with {@link #from(String...)} (do not abuse it or the client will not be able to join).
* <p>
* Example: hey
*/
@ -25,6 +25,8 @@ public class ArgumentWord extends Argument<String> {
/**
* Used to force the use of a few precise words instead of complete freedom.
* <p>
* WARNING: having an array too long would result in a packet too big or the client being stuck during login.
*
* @param restrictions the accepted words
* @return 'this'
@ -73,7 +75,7 @@ public class ArgumentWord extends Argument<String> {
}
/**
* Gets all the word restrictions
* Gets all the word restrictions.
*
* @return the word restrictions, can be null
*/

View File

@ -22,7 +22,7 @@ public class StatusRequestPacket implements ClientPreplayPacket {
responseData.setMaxPlayer(0);
responseData.setOnline(0);
responseData.setDescription("Minestom Server");
responseData.setFavicon("data:image/png;base64,<data>");
responseData.setFavicon("");
if (consumer != null)
consumer.accept(connection, responseData);

View File

@ -362,6 +362,9 @@ public final class NBTUtils {
/**
* Converts an object into its {@link NBT} equivalent.
* <p>
* If {@code type} is not a primitive type or primitive array and {@code supportDataType} is true,
* the data will be encoded with the appropriate {@link DataType} into a byte array.
*
* @param value the value to convert
* @param type the type of the value, used to know which {@link DataType} to use if {@code value} is not a primitive type