From f4534c8273d9db5323fe6c9ae34a3e210c56f030 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 15 Mar 2023 18:41:25 +1100 Subject: [PATCH] #3446: Fix < 1.19 support --- .../md_5/bungee/protocol/packet/Commands.java | 305 +++++++++--------- 1 file changed, 148 insertions(+), 157 deletions(-) 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 2f103013..05761bf5 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 @@ -582,176 +582,167 @@ public class Commands extends DefinedPacket register( "minecraft:item_enchantment", VOID ); register( "minecraft:entity_summon", VOID ); register( "minecraft:dimension", VOID ); - register( "minecraft:time_legacy", VOID ); // 1.14 + register( "minecraft:time", 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 - register( "minecraft:template_rotation", VOID ); // 1.19 register( "minecraft:uuid", VOID ); // 1.16 - register( "minecraft:gamemode", VOID ); // 1.19.3 - 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[] { - 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:mob_effect" ), - get( "minecraft:function" ), - get( "minecraft:entity_anchor" ), - get( "minecraft:int_range" ), - get( "minecraft:float_range" ), - get( "minecraft:item_enchantment" ), - get( "minecraft:entity_summon" ), - get( "minecraft:dimension" ), - get( "minecraft:time_legacy" ), - get( "minecraft:resource_or_tag" ), - get( "minecraft:resource" ), - get( "minecraft:template_mirror" ), - get( "minecraft:template_rotation" ), - get( "minecraft:uuid" ) + get( "brigadier:bool", VOID ), + get( "brigadier:float", FLOAT_RANGE ), + get( "brigadier:double", DOUBLE_RANGE ), + get( "brigadier:integer", INTEGER_RANGE ), + get( "brigadier:long", LONG_RANGE ), + get( "brigadier:string", STRING ), + get( "minecraft:entity", BYTE ), + get( "minecraft:game_profile", VOID ), + get( "minecraft:block_pos", VOID ), + get( "minecraft:column_pos", VOID ), + get( "minecraft:vec3", VOID ), + get( "minecraft:vec2", VOID ), + get( "minecraft:block_state", VOID ), + get( "minecraft:block_predicate", VOID ), + get( "minecraft:item_stack", VOID ), + get( "minecraft:item_predicate", VOID ), + get( "minecraft:color", VOID ), + get( "minecraft:component", VOID ), + get( "minecraft:message", VOID ), + get( "minecraft:nbt_compound_tag", VOID ), + get( "minecraft:nbt_tag", VOID ), + get( "minecraft:nbt_path", VOID ), + get( "minecraft:objective", VOID ), + get( "minecraft:objective_criteria", VOID ), + get( "minecraft:operation", VOID ), + get( "minecraft:particle", VOID ), + get( "minecraft:angle", VOID ), + get( "minecraft:rotation", VOID ), + get( "minecraft:scoreboard_slot", VOID ), + get( "minecraft:score_holder", BYTE ), + get( "minecraft:swizzle", VOID ), + get( "minecraft:team", VOID ), + get( "minecraft:item_slot", VOID ), + get( "minecraft:resource_location", VOID ), + get( "minecraft:mob_effect", VOID ), + get( "minecraft:function", VOID ), + get( "minecraft:entity_anchor", VOID ), + get( "minecraft:int_range", VOID ), + get( "minecraft:float_range", VOID ), + get( "minecraft:item_enchantment", VOID ), + get( "minecraft:entity_summon", VOID ), + get( "minecraft:dimension", VOID ), + get( "minecraft:time", VOID ), + get( "minecraft:resource_or_tag", RAW_STRING ), + get( "minecraft:resource", RAW_STRING ), + get( "minecraft:template_mirror", VOID ), + get( "minecraft:template_rotation", VOID ), + get( "minecraft:uuid", VOID ), }; IDS_1_19_3 = 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_legacy" ), - 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( "brigadier:bool", VOID ), + get( "brigadier:float", FLOAT_RANGE ), + get( "brigadier:double", DOUBLE_RANGE ), + get( "brigadier:integer", INTEGER_RANGE ), + get( "brigadier:long", LONG_RANGE ), + get( "brigadier:string", STRING ), + get( "minecraft:entity", BYTE ), + get( "minecraft:game_profile", VOID ), + get( "minecraft:block_pos", VOID ), + get( "minecraft:column_pos", VOID ), + get( "minecraft:vec3", VOID ), + get( "minecraft:vec2", VOID ), + get( "minecraft:block_state", VOID ), + get( "minecraft:block_predicate", VOID ), + get( "minecraft:item_stack", VOID ), + get( "minecraft:item_predicate", VOID ), + get( "minecraft:color", VOID ), + get( "minecraft:component", VOID ), + get( "minecraft:message", VOID ), + get( "minecraft:nbt_compound_tag", VOID ), + get( "minecraft:nbt_tag", VOID ), + get( "minecraft:nbt_path", VOID ), + get( "minecraft:objective", VOID ), + get( "minecraft:objective_criteria", VOID ), + get( "minecraft:operation", VOID ), + get( "minecraft:particle", VOID ), + get( "minecraft:angle", VOID ), + get( "minecraft:rotation", VOID ), + get( "minecraft:scoreboard_slot", VOID ), + get( "minecraft:score_holder", BYTE ), + get( "minecraft:swizzle", VOID ), + get( "minecraft:team", VOID ), + get( "minecraft:item_slot", VOID ), + get( "minecraft:resource_location", VOID ), + get( "minecraft:function", VOID ), + get( "minecraft:entity_anchor", VOID ), + get( "minecraft:int_range", VOID ), + get( "minecraft:float_range", VOID ), + get( "minecraft:dimension", VOID ), + get( "minecraft:gamemode", VOID ), + get( "minecraft:time", VOID ), + get( "minecraft:resource_or_tag", RAW_STRING ), + get( "minecraft:resource_or_tag_key", RAW_STRING ), + get( "minecraft:resource", RAW_STRING ), + get( "minecraft:resource_key", RAW_STRING ), + get( "minecraft:template_mirror", VOID ), + get( "minecraft:template_rotation", VOID ), + get( "minecraft:uuid", VOID ) }; 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" ) + get( "brigadier:bool", VOID ), + get( "brigadier:float", FLOAT_RANGE ), + get( "brigadier:double", DOUBLE_RANGE ), + get( "brigadier:integer", INTEGER_RANGE ), + get( "brigadier:long", LONG_RANGE ), + get( "brigadier:string", STRING ), + get( "minecraft:entity", BYTE ), + get( "minecraft:game_profile", VOID ), + get( "minecraft:block_pos", VOID ), + get( "minecraft:column_pos", VOID ), + get( "minecraft:vec3", VOID ), + get( "minecraft:vec2", VOID ), + get( "minecraft:block_state", VOID ), + get( "minecraft:block_predicate", VOID ), + get( "minecraft:item_stack", VOID ), + get( "minecraft:item_predicate", VOID ), + get( "minecraft:color", VOID ), + get( "minecraft:component", VOID ), + get( "minecraft:message", VOID ), + get( "minecraft:nbt_compound_tag", VOID ), + get( "minecraft:nbt_tag", VOID ), + get( "minecraft:nbt_path", VOID ), + get( "minecraft:objective", VOID ), + get( "minecraft:objective_criteria", VOID ), + get( "minecraft:operation", VOID ), + get( "minecraft:particle", VOID ), + get( "minecraft:angle", VOID ), + get( "minecraft:rotation", VOID ), + get( "minecraft:scoreboard_slot", VOID ), + get( "minecraft:score_holder", BYTE ), + get( "minecraft:swizzle", VOID ), + get( "minecraft:team", VOID ), + get( "minecraft:item_slot", VOID ), + get( "minecraft:resource_location", VOID ), + get( "minecraft:function", VOID ), + get( "minecraft:entity_anchor", VOID ), + get( "minecraft:int_range", VOID ), + get( "minecraft:float_range", VOID ), + get( "minecraft:dimension", VOID ), + get( "minecraft:gamemode", VOID ), + get( "minecraft:time", INTEGER ), + get( "minecraft:resource_or_tag", RAW_STRING ), + get( "minecraft:resource_or_tag_key", RAW_STRING ), + get( "minecraft:resource", RAW_STRING ), + get( "minecraft:resource_key", RAW_STRING ), + get( "minecraft:template_mirror", VOID ), + get( "minecraft:template_rotation", VOID ), + get( "minecraft:uuid", VOID ), + get( "minecraft:heightmap", VOID ) }; } @@ -760,9 +751,9 @@ public class Commands extends DefinedPacket PROVIDERS.put( name, serializer ); } - private static ArgumentSerializer get(String name) + private static ArgumentSerializer get(String name, ArgumentSerializer serializer) { - return PROVIDERS.get( name ); + return serializer; } private static ArgumentType read(ByteBuf buf, int protocolVersion)