Skip to content

Commit 0da2751

Browse files
Finish 1.20.4 update (#2683)
* update PacketTypes * add new enum values for EnumWrappers and add ScoreboardAction to known invalids as it was removed * make MinecraftKey optional in AutoWrapperTest * update adventure dependencies to 4.14.0 * fix typo in maximum minecraft version * add chat component for disconnect packet when running clone test * adjust chat components to new component structure
1 parent 2448d83 commit 0da2751

File tree

7 files changed

+134
-108
lines changed

7 files changed

+134
-108
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies {
3737
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
3838
compileOnly 'org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT'
3939
compileOnly 'io.netty:netty-all:4.0.23.Final'
40-
compileOnly 'net.kyori:adventure-text-serializer-gson:4.13.0'
40+
compileOnly 'net.kyori:adventure-text-serializer-gson:4.14.0'
4141
compileOnly 'com.googlecode.json-simple:json-simple:1.1.1'
4242

4343
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
@@ -47,8 +47,8 @@ dependencies {
4747
testImplementation 'io.netty:netty-common:4.1.97.Final'
4848
testImplementation 'io.netty:netty-transport:4.1.97.Final'
4949
testImplementation 'org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT'
50-
testImplementation 'net.kyori:adventure-text-serializer-gson:4.13.0'
51-
testImplementation 'net.kyori:adventure-text-serializer-plain:4.13.1'
50+
testImplementation 'net.kyori:adventure-text-serializer-gson:4.14.0'
51+
testImplementation 'net.kyori:adventure-text-serializer-plain:4.14.0'
5252
}
5353

5454
java {

src/main/java/com/comphenix/protocol/PacketType.java

Lines changed: 109 additions & 91 deletions
Large diffs are not rendered by default.

src/main/java/com/comphenix/protocol/ProtocolLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ProtocolLibrary {
3737
/**
3838
* The maximum version ProtocolLib has been tested with.
3939
*/
40-
public static final String MAXIMUM_MINECRAFT_VERSION = "1.20.24";
40+
public static final String MAXIMUM_MINECRAFT_VERSION = "1.20.4";
4141

4242
/**
4343
* The date (with ISO 8601 or YYYY-MM-DD) when the most recent version (1.20.4) was released.

src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ public enum ResourcePackStatus {
121121
SUCCESSFULLY_LOADED,
122122
DECLINED,
123123
FAILED_DOWNLOAD,
124-
ACCEPTED
124+
ACCEPTED,
125+
DOWNLOADED,
126+
INVALID_URL,
127+
FAILED_RELOAD,
128+
DISCARDED;
125129
}
126130

127131
public enum PlayerInfoAction {
@@ -404,7 +408,10 @@ public enum EntityPose {
404408
ROARING,
405409
SNIFFING,
406410
EMERGING,
407-
DIGGING;
411+
DIGGING,
412+
SLIDING,
413+
SHOOTING,
414+
INHALING;
408415

409416
private final static EquivalentConverter<EntityPose> POSE_CONVERTER = EnumWrappers.getEntityPoseConverter();
410417

src/test/java/com/comphenix/protocol/events/PacketContainerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public void testChatComponents() {
363363
chatPacket.getChatComponents().write(0,
364364
WrappedChatComponent.fromChatMessage("You shall not " + ChatColor.ITALIC + "pass!")[0]);
365365

366-
assertEquals("{\"extra\":[{\"text\":\"You shall not \"},{\"italic\":true,\"text\":\"pass!\"}],\"text\":\"\"}",
366+
assertEquals("{\"text\":\"\",\"extra\":[\"You shall not \",{\"text\":\"pass!\",\"italic\":true}]}",
367367
chatPacket.getChatComponents().read(0).getJson());
368368
}
369369

@@ -901,7 +901,7 @@ public void testCloning() {
901901
new WrappedDataValue(0, Registry.get(CatVariant.class), catVariantRegistry.e(CatVariant.e)),
902902
new WrappedDataValue(0, Registry.get(FrogVariant.class), FrogVariant.a)
903903
));
904-
} else if (type == PacketType.Play.Server.CHAT) {
904+
} else if (type == PacketType.Play.Server.CHAT || type == PacketType.Login.Server.DISCONNECT) {
905905
constructed.getChatComponents().write(0, ComponentConverter.fromBaseComponent(TEST_COMPONENT));
906906
} else if (type == PacketType.Play.Server.REMOVE_ENTITY_EFFECT || type == PacketType.Play.Server.ENTITY_EFFECT) {
907907
constructed.getEffectTypes().write(0, PotionEffectType.GLOWING);

src/test/java/com/comphenix/protocol/wrappers/AutoWrapperTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void testToNms() {
3535
display.title = WrappedChatComponent.fromText("Test123");
3636
display.description = WrappedChatComponent.fromText("Test567");
3737
display.item = new ItemStack(Material.GOLD_INGOT);
38-
display.background = new MinecraftKey("test");
38+
display.background = Optional.of(new MinecraftKey("test"));
3939
display.frameType = WrappedFrameType.CHALLENGE;
4040
display.announceChat = false;
4141
display.showToast = true;
@@ -48,7 +48,7 @@ public void testToNms() {
4848
assertTrue(nms.h());
4949
assertTrue(nms.j());
5050
assertFalse(nms.i());
51-
assertTrue(nms.d().isPresent());
51+
assertTrue(nms.d().isPresent());
5252
assertEquals("test", nms.d().get().a());
5353
validateRawText(nms.a(), "Test123");
5454
validateRawText(nms.b(), "Test567");
@@ -77,9 +77,10 @@ public void testFromNms() {
7777
assertTrue(wrapped.showToast);
7878
assertTrue(wrapped.hidden);
7979
assertFalse(wrapped.announceChat);
80-
assertEquals("test", wrapped.background.getKey());
81-
assertEquals("{\"text\":\"Test123\"}", wrapped.title.getJson());
82-
assertEquals("{\"text\":\"Test567\"}", wrapped.description.getJson());
80+
assertTrue(wrapped.background.isPresent());
81+
assertEquals("test", wrapped.background.get().getKey());
82+
assertEquals("\"Test123\"", wrapped.title.getJson());
83+
assertEquals("\"Test567\"", wrapped.description.getJson());
8384
assertSame(WrappedFrameType.CHALLENGE, wrapped.frameType);
8485
assertSame(Material.ENDER_EYE, wrapped.item.getType());
8586
assertEquals(5f, wrapped.x, 0f);
@@ -92,14 +93,14 @@ private AutoWrapper<WrappedAdvancementDisplay> displayWrapper() {
9293
.field(0, BukkitConverters.getWrappedChatComponentConverter())
9394
.field(1, BukkitConverters.getWrappedChatComponentConverter())
9495
.field(2, BukkitConverters.getItemStackConverter())
95-
.field(3, MinecraftKey.getConverter())
96+
.field(3, Converters.optional(MinecraftKey.getConverter()))
9697
.field(4, EnumWrappers.getGenericConverter(getMinecraftClass("advancements.AdvancementFrameType", "advancements.FrameType"),
9798
WrappedFrameType.class));
9899
}
99100

100101
private void validateRawText(IChatBaseComponent component, String expected) {
101102
LiteralContents content = assertInstanceOf(LiteralContents.class, component.b());
102-
assertEquals(expected, content.a());
103+
assertEquals(expected, content.b());
103104
}
104105

105106
public enum WrappedFrameType {
@@ -113,7 +114,7 @@ public static final class WrappedAdvancementDisplay {
113114
public WrappedChatComponent title;
114115
public WrappedChatComponent description;
115116
public ItemStack item;
116-
public MinecraftKey background;
117+
public Optional<MinecraftKey> background;
117118
public WrappedFrameType frameType;
118119
public boolean showToast;
119120
public boolean announceChat;

src/test/java/com/comphenix/protocol/wrappers/EnumWrappersTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
public class EnumWrappersTest {
1818

1919
private static final Set<String> KNOWN_INVALID = Sets.newHashSet(
20-
"Particle", "WorldBorderAction", "CombatEventType", "TitleAction", "ChatType", "TitleAction"
20+
"Particle", "WorldBorderAction", "CombatEventType", "TitleAction", "ChatType", "TitleAction", "ScoreboardAction"
2121
);
2222

2323
@BeforeAll

0 commit comments

Comments
 (0)