diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java index c122cad97..a8b21559e 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java @@ -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 ); diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index 5c550c510..064441817 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -41,7 +41,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.3.0 diff --git a/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java b/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java index bb974a4a7..b58dd6f28 100644 --- a/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java +++ b/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java @@ -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 ); } }; diff --git a/pom.xml b/pom.xml index bbc22f78d..00ec645a7 100644 --- a/pom.xml +++ b/pom.xml @@ -127,12 +127,12 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.11.0 org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + 3.2.1 process-classes @@ -157,7 +157,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin - 1.20 + 1.22 process-classes @@ -270,7 +270,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.5.0 @@ -308,7 +308,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 verify diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index f746c4ff4..746defae7 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -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 ) ); } }, diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java index 17d741d86..580445d7d 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java @@ -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 SUPPORTED_VERSIONS; public static final List 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 ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java index 80a16f655..2f103013d 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java @@ -309,6 +309,7 @@ public class Commands extends DefinedPacket private static final Map 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, ProperArgumentSerializer> PROPER_PROVIDERS = new HashMap<>(); // private static final ArgumentSerializer VOID = new ArgumentSerializer() @@ -352,7 +353,7 @@ public class Commands extends DefinedPacket buf.writeByte( t ); } }; - private static final ArgumentSerializer FLOAT = new ArgumentSerializer() + private static final ArgumentSerializer FLOAT_RANGE = new ArgumentSerializer() { @Override protected FloatArgumentType read(ByteBuf buf) @@ -381,7 +382,7 @@ public class Commands extends DefinedPacket } } }; - private static final ArgumentSerializer DOUBLE = new ArgumentSerializer() + private static final ArgumentSerializer DOUBLE_RANGE = new ArgumentSerializer() { @Override protected DoubleArgumentType read(ByteBuf buf) @@ -410,7 +411,7 @@ public class Commands extends DefinedPacket } } }; - private static final ArgumentSerializer INTEGER = new ArgumentSerializer() + private static final ArgumentSerializer INTEGER_RANGE = new ArgumentSerializer() { @Override protected IntegerArgumentType read(ByteBuf buf) @@ -439,7 +440,21 @@ public class Commands extends DefinedPacket } } }; - private static final ArgumentSerializer LONG = new ArgumentSerializer() + private static final ArgumentSerializer INTEGER = new ArgumentSerializer() + { + @Override + protected Integer read(ByteBuf buf) + { + return buf.readInt(); + } + + @Override + protected void write(ByteBuf buf, Integer t) + { + buf.writeInt( t ); + } + }; + private static final ArgumentSerializer LONG_RANGE = new ArgumentSerializer() { @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 diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ServerData.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ServerData.java index 721b4f909..8536bae77 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ServerData.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ServerData.java @@ -17,20 +17,26 @@ 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() ) { - icon = readString( buf ); + if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 ) + { + icon = DefinedPacket.readArray( buf ); + } else + { + icon = readString( buf ); + } } if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 ) @@ -49,17 +55,31 @@ public class ServerData extends DefinedPacket { if ( motd != null ) { - buf.writeBoolean( true ); + 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 ); diff --git a/proxy/pom.xml b/proxy/pom.xml index 08d132e8e..7ef058868 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -99,9 +99,9 @@ compile - mysql - mysql-connector-java - 8.0.29 + com.mysql + mysql-connector-j + 8.0.32 runtime diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index 25fdc7420..05cdf684b 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -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; } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java index 68c6ca2d2..81146df68 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java @@ -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" ); } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java index 7241dc56b..e5e784a01 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java @@ -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;