Minecraft 1.19.4 support

This commit is contained in:
md_5 2023-03-15 03:30:00 +11:00
parent 1b6d845530
commit f9712cbc7c
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
12 changed files with 194 additions and 64 deletions

View File

@ -33,6 +33,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.event.EventBus;
import net.md_5.bungee.event.EventHandler;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.introspector.PropertyUtils;
@ -64,7 +65,7 @@ public final class PluginManager
this.proxy = proxy;
// Ignore unknown entries in the plugin descriptions
Constructor yamlConstructor = new Constructor();
Constructor yamlConstructor = new Constructor( new LoaderOptions() );
PropertyUtils propertyUtils = yamlConstructor.getPropertyUtils();
propertyUtils.setSkipMissingProperties( true );
yamlConstructor.setPropertyUtils( propertyUtils );

View File

@ -41,7 +41,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>

View File

@ -14,6 +14,7 @@ import java.util.Map;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.nodes.Node;
@ -29,7 +30,10 @@ public class YamlConfiguration extends ConfigurationProvider
@Override
protected Yaml initialValue()
{
Representer representer = new Representer()
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
Representer representer = new Representer( options )
{
{
representers.put( Configuration.class, new Represent()
@ -43,10 +47,7 @@ public class YamlConfiguration extends ConfigurationProvider
}
};
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
return new Yaml( new Constructor(), representer, options );
return new Yaml( new Constructor( new LoaderOptions() ), representer, options );
}
};

10
pom.xml
View File

@ -127,12 +127,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.1</version>
<executions>
<execution>
<phase>process-classes</phase>
@ -157,7 +157,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.20</version>
<version>1.22</version>
<executions>
<execution>
<phase>process-classes</phase>
@ -270,7 +270,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.5.0</version>
<executions>
<!-- Execute Javadoc once normally to catch any warnings -->
<execution>
@ -308,7 +308,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>

View File

@ -84,7 +84,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x23 )
);
TO_CLIENT.registerPacket(
Login.class,
@ -98,7 +99,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x23 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x25 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x24 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x24 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x28 )
);
TO_CLIENT.registerPacket( Chat.class,
Chat::new,
@ -125,7 +127,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_19, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x3D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x41 )
);
TO_CLIENT.registerPacket(
BossBar.class,
@ -134,7 +137,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_16, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_17, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0A )
map( ProtocolConstants.MINECRAFT_1_19, 0x0A ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xB )
);
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
@ -163,7 +167,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_16_2, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_17, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xF )
);
TO_CLIENT.registerPacket(
ScoreboardObjective.class,
@ -177,7 +182,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
map( ProtocolConstants.MINECRAFT_1_17, 0x53 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x54 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x54 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x58 )
);
TO_CLIENT.registerPacket(
ScoreboardScore.class,
@ -191,7 +197,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
map( ProtocolConstants.MINECRAFT_1_17, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x57 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x57 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5B )
);
TO_CLIENT.registerPacket(
ScoreboardDisplay.class,
@ -205,7 +212,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
map( ProtocolConstants.MINECRAFT_1_17, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4F ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x51 )
);
TO_CLIENT.registerPacket(
Team.class,
@ -219,7 +227,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_17, 0x55 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x58 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x56 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5A )
);
TO_CLIENT.registerPacket(
PluginMessage.class,
@ -234,7 +243,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x16 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x15 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x17 )
);
TO_CLIENT.registerPacket(
Kick.class,
@ -249,7 +259,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x19 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x17 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1A )
);
TO_CLIENT.registerPacket(
Title.class,
@ -264,14 +275,16 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_18, 0x5A ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5B )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5F )
);
TO_CLIENT.registerPacket(
ClearTitles.class,
ClearTitles::new,
map( ProtocolConstants.MINECRAFT_1_17, 0x10 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xE )
);
TO_CLIENT.registerPacket(
Subtitle.class,
@ -279,7 +292,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
map( ProtocolConstants.MINECRAFT_1_18, 0x58 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x59 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5D )
);
TO_CLIENT.registerPacket(
TitleTimes.class,
@ -287,14 +301,16 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
map( ProtocolConstants.MINECRAFT_1_18, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x60 )
);
TO_CLIENT.registerPacket(
SystemChat.class,
SystemChat::new,
map( ProtocolConstants.MINECRAFT_1_19, 0x5F ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x62 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x60 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x60 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x64 )
);
TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class,
@ -312,7 +328,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
map( ProtocolConstants.MINECRAFT_1_19, 0x60 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x63 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x61 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x61 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x65 )
);
TO_CLIENT.registerPacket(
EntityStatus.class,
@ -327,7 +344,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_19, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x19 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x19 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1C )
);
TO_CLIENT.registerPacket(
Commands.class,
@ -338,7 +356,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_16_2, 0x10 ),
map( ProtocolConstants.MINECRAFT_1_17, 0x12 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0E )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x10 )
);
TO_CLIENT.registerPacket(
GameState.class,
@ -349,7 +368,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
map( ProtocolConstants.MINECRAFT_1_19, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1F )
);
TO_CLIENT.registerPacket(
ViewDistance.class,
@ -360,24 +380,28 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x49 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4B )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4B ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x4F )
);
TO_CLIENT.registerPacket(
ServerData.class,
ServerData::new,
map( ProtocolConstants.MINECRAFT_1_19, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x41 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x45 )
);
TO_CLIENT.registerPacket(
PlayerListItemRemove.class,
PlayerListItemRemove::new,
map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x39 )
);
TO_CLIENT.registerPacket(
PlayerListItemUpdate.class,
PlayerListItemUpdate::new,
map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x3A )
);
TO_SERVER.registerPacket(
@ -393,7 +417,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_19, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x12 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x11 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x12 )
);
TO_SERVER.registerPacket( Chat.class,
Chat::new,
@ -427,7 +452,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x09 )
);
TO_SERVER.registerPacket(
ClientSettings.class,
@ -439,7 +465,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x08 )
);
TO_SERVER.registerPacket(
PluginMessage.class,
@ -453,7 +480,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x0D )
);
}
},

View File

@ -41,6 +41,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_19 = 759;
public static final int MINECRAFT_1_19_1 = 760;
public static final int MINECRAFT_1_19_3 = 761;
public static final int MINECRAFT_1_19_4 = 762;
public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS;
@ -94,7 +95,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_18_2,
ProtocolConstants.MINECRAFT_1_19,
ProtocolConstants.MINECRAFT_1_19_1,
ProtocolConstants.MINECRAFT_1_19_3
ProtocolConstants.MINECRAFT_1_19_3,
ProtocolConstants.MINECRAFT_1_19_4
);
if ( SNAPSHOT_SUPPORT )

View File

@ -309,6 +309,7 @@ public class Commands extends DefinedPacket
private static final Map<String, ArgumentSerializer> PROVIDERS = new HashMap<>();
private static final ArgumentSerializer[] IDS_1_19;
private static final ArgumentSerializer[] IDS_1_19_3;
private static final ArgumentSerializer[] IDS_1_19_4;
private static final Map<Class<?>, ProperArgumentSerializer<?>> PROPER_PROVIDERS = new HashMap<>();
//
private static final ArgumentSerializer<Void> VOID = new ArgumentSerializer<Void>()
@ -352,7 +353,7 @@ public class Commands extends DefinedPacket
buf.writeByte( t );
}
};
private static final ArgumentSerializer<FloatArgumentType> FLOAT = new ArgumentSerializer<FloatArgumentType>()
private static final ArgumentSerializer<FloatArgumentType> FLOAT_RANGE = new ArgumentSerializer<FloatArgumentType>()
{
@Override
protected FloatArgumentType read(ByteBuf buf)
@ -381,7 +382,7 @@ public class Commands extends DefinedPacket
}
}
};
private static final ArgumentSerializer<DoubleArgumentType> DOUBLE = new ArgumentSerializer<DoubleArgumentType>()
private static final ArgumentSerializer<DoubleArgumentType> DOUBLE_RANGE = new ArgumentSerializer<DoubleArgumentType>()
{
@Override
protected DoubleArgumentType read(ByteBuf buf)
@ -410,7 +411,7 @@ public class Commands extends DefinedPacket
}
}
};
private static final ArgumentSerializer<IntegerArgumentType> INTEGER = new ArgumentSerializer<IntegerArgumentType>()
private static final ArgumentSerializer<IntegerArgumentType> INTEGER_RANGE = new ArgumentSerializer<IntegerArgumentType>()
{
@Override
protected IntegerArgumentType read(ByteBuf buf)
@ -439,7 +440,21 @@ public class Commands extends DefinedPacket
}
}
};
private static final ArgumentSerializer<LongArgumentType> LONG = new ArgumentSerializer<LongArgumentType>()
private static final ArgumentSerializer<Integer> INTEGER = new ArgumentSerializer<Integer>()
{
@Override
protected Integer read(ByteBuf buf)
{
return buf.readInt();
}
@Override
protected void write(ByteBuf buf, Integer t)
{
buf.writeInt( t );
}
};
private static final ArgumentSerializer<LongArgumentType> LONG_RANGE = new ArgumentSerializer<LongArgumentType>()
{
@Override
protected LongArgumentType read(ByteBuf buf)
@ -523,10 +538,10 @@ public class Commands extends DefinedPacket
static
{
register( "brigadier:bool", VOID );
register( "brigadier:float", FLOAT );
register( "brigadier:double", DOUBLE );
register( "brigadier:integer", INTEGER );
register( "brigadier:long", LONG );
register( "brigadier:float", FLOAT_RANGE );
register( "brigadier:double", DOUBLE_RANGE );
register( "brigadier:integer", INTEGER_RANGE );
register( "brigadier:long", LONG_RANGE );
register( "brigadier:string", STRING );
PROPER_PROVIDERS.put( StringArgumentType.class, STRING );
@ -567,7 +582,7 @@ public class Commands extends DefinedPacket
register( "minecraft:item_enchantment", VOID );
register( "minecraft:entity_summon", VOID );
register( "minecraft:dimension", VOID );
register( "minecraft:time", VOID ); // 1.14
register( "minecraft:time_legacy", VOID ); // 1.14
register( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2
register( "minecraft:resource", RAW_STRING ); // 1.18.2
register( "minecraft:template_mirror", VOID ); // 1.19
@ -578,6 +593,9 @@ public class Commands extends DefinedPacket
register( "minecraft:resource_or_tag_key", RAW_STRING ); // 1.19.3
register( "minecraft:resource_key", RAW_STRING ); // 1.19.3
register( "minecraft:heightmap", VOID ); // 1.19.4
register( "minecraft:time", INTEGER ); // 1.19.4
register( "minecraft:nbt", VOID ); // 1.13 // removed
IDS_1_19 = new ArgumentSerializer[]
{
@ -623,7 +641,7 @@ public class Commands extends DefinedPacket
get( "minecraft:item_enchantment" ),
get( "minecraft:entity_summon" ),
get( "minecraft:dimension" ),
get( "minecraft:time" ),
get( "minecraft:time_legacy" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource" ),
get( "minecraft:template_mirror" ),
@ -673,7 +691,7 @@ public class Commands extends DefinedPacket
get( "minecraft:float_range" ),
get( "minecraft:dimension" ),
get( "minecraft:gamemode" ),
get( "minecraft:time" ),
get( "minecraft:time_legacy" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource_or_tag_key" ),
get( "minecraft:resource" ),
@ -682,6 +700,59 @@ public class Commands extends DefinedPacket
get( "minecraft:template_rotation" ),
get( "minecraft:uuid" )
};
IDS_1_19_4 = new ArgumentSerializer[]
{
get( "brigadier:bool" ),
get( "brigadier:float" ),
get( "brigadier:double" ),
get( "brigadier:integer" ),
get( "brigadier:long" ),
get( "brigadier:string" ),
get( "minecraft:entity" ),
get( "minecraft:game_profile" ),
get( "minecraft:block_pos" ),
get( "minecraft:column_pos" ),
get( "minecraft:vec3" ),
get( "minecraft:vec2" ),
get( "minecraft:block_state" ),
get( "minecraft:block_predicate" ),
get( "minecraft:item_stack" ),
get( "minecraft:item_predicate" ),
get( "minecraft:color" ),
get( "minecraft:component" ),
get( "minecraft:message" ),
get( "minecraft:nbt_compound_tag" ),
get( "minecraft:nbt_tag" ),
get( "minecraft:nbt_path" ),
get( "minecraft:objective" ),
get( "minecraft:objective_criteria" ),
get( "minecraft:operation" ),
get( "minecraft:particle" ),
get( "minecraft:angle" ),
get( "minecraft:rotation" ),
get( "minecraft:scoreboard_slot" ),
get( "minecraft:score_holder" ),
get( "minecraft:swizzle" ),
get( "minecraft:team" ),
get( "minecraft:item_slot" ),
get( "minecraft:resource_location" ),
get( "minecraft:function" ),
get( "minecraft:entity_anchor" ),
get( "minecraft:int_range" ),
get( "minecraft:float_range" ),
get( "minecraft:dimension" ),
get( "minecraft:gamemode" ),
get( "minecraft:time" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource_or_tag_key" ),
get( "minecraft:resource" ),
get( "minecraft:resource_key" ),
get( "minecraft:template_mirror" ),
get( "minecraft:template_rotation" ),
get( "minecraft:uuid" ),
get( "minecraft:heightmap" )
};
}
private static void register(String name, ArgumentSerializer serializer)
@ -703,7 +774,10 @@ public class Commands extends DefinedPacket
{
key = readVarInt( buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
reader = IDS_1_19_4[(Integer) key];
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
{
reader = IDS_1_19_3[(Integer) key];
} else

View File

@ -17,21 +17,27 @@ public class ServerData extends DefinedPacket
{
private String motd;
private String icon;
private Object icon;
private boolean preview;
private boolean enforceSecure;
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
if ( buf.readBoolean() )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 || buf.readBoolean() )
{
motd = readString( buf, 262144 );
}
if ( buf.readBoolean() )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
icon = DefinedPacket.readArray( buf );
} else
{
icon = readString( buf );
}
}
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
{
@ -48,18 +54,32 @@ public class ServerData extends DefinedPacket
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
if ( motd != null )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
buf.writeBoolean( true );
}
writeString( motd, buf, 262144 );
} else
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
throw new IllegalArgumentException( "MOTD required for this version" );
}
buf.writeBoolean( false );
}
if ( icon != null )
{
buf.writeBoolean( true );
writeString( icon, buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
DefinedPacket.writeArray( (byte[]) icon, buf );
} else
{
writeString( (String) icon, buf );
}
} else
{
buf.writeBoolean( false );

View File

@ -99,9 +99,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version>
<scope>runtime</scope>
</dependency>
<!-- add these back in as they are not exposed by the API -->

View File

@ -698,9 +698,10 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(ServerData serverData) throws Exception
{
serverData.setMotd( null );
serverData.setIcon( null );
con.unsafe().sendPacket( serverData );
// 1.19.4 doesn't allow empty MOTD and we probably don't want to simulate a ping event to get the "correct" one
// serverData.setMotd( null );
// serverData.setIcon( null );
// con.unsafe().sendPacket( serverData );
throw CancelSendSignal.INSTANCE;
}

View File

@ -79,6 +79,8 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_19_1:
case ProtocolConstants.MINECRAFT_1_19_3:
return EntityMap_1_16_2.INSTANCE_1_19_1;
case ProtocolConstants.MINECRAFT_1_19_4:
return EntityMap_1_16_2.INSTANCE_1_19_4;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
}

View File

@ -19,6 +19,7 @@ class EntityMap_1_16_2 extends EntityMap
static final EntityMap_1_16_2 INSTANCE_1_18 = new EntityMap_1_16_2( 0x04, 0x2D );
static final EntityMap_1_16_2 INSTANCE_1_19 = new EntityMap_1_16_2( 0x02, 0x2F );
static final EntityMap_1_16_2 INSTANCE_1_19_1 = new EntityMap_1_16_2( 0x02, 0x30 );
static final EntityMap_1_16_2 INSTANCE_1_19_4 = new EntityMap_1_16_2( 0x03, 0x30 );
//
private final int spawnPlayerId;
private final int spectateId;