From 257a682e2c16c9204fd966cbe4f196e363d5d268 Mon Sep 17 00:00:00 2001
From: CatCoderr
Date: Wed, 9 Oct 2024 00:42:30 +0300
Subject: [PATCH] feat(6.2.7): support Minecraft 1.20.5, 1.20.6, 1.21
---
README.md | 8 ++++----
build.gradle.kts | 2 +-
run_test_server.sh | 2 +-
.../me/catcoder/sidebar/protocol/PacketIds.java | 16 +++++++++++-----
.../sidebar/protocol/ProtocolConstants.java | 5 +++--
.../util/version/MinecraftProtocolVersion.java | 3 +++
6 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 684256e..60ee2df 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
-
+
* [Features](#features)
@@ -66,7 +66,7 @@ or [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/) (f
me.catcoder
bukkit-sidebar
- 6.2.6-SNAPSHOT
+ 6.2.7-SNAPSHOT
```
@@ -79,7 +79,7 @@ repositories {
```
```groovy
dependencies {
- implementation 'me.catcoder:bukkit-sidebar:6.2.6-SNAPSHOT'
+ implementation 'me.catcoder:bukkit-sidebar:6.2.7-SNAPSHOT'
}
```
@@ -92,7 +92,7 @@ repositories {
```
```kotlin
dependencies {
- implementation("me.catcoder:bukkit-sidebar:6.2.6-SNAPSHOT")
+ implementation("me.catcoder:bukkit-sidebar:6.2.7-SNAPSHOT")
}
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 1b8a458..0c3398c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,7 +6,7 @@ plugins {
}
group = "me.catcoder"
-version = "6.2.6-SNAPSHOT"
+version = "6.2.7-SNAPSHOT"
description = "Powerful feature-packed Minecraft scoreboard library"
extra["sonatypeUsername"] = System.getenv("SONATYPE_USERNAME")
diff --git a/run_test_server.sh b/run_test_server.sh
index 8eb40eb..fb1357c 100755
--- a/run_test_server.sh
+++ b/run_test_server.sh
@@ -1,4 +1,4 @@
-VIA_VERSION=4.9.3
+VIA_VERSION=5.0.3
./gradlew clean shadowJar
diff --git a/src/main/java/me/catcoder/sidebar/protocol/PacketIds.java b/src/main/java/me/catcoder/sidebar/protocol/PacketIds.java
index 4662dcd..58467e5 100644
--- a/src/main/java/me/catcoder/sidebar/protocol/PacketIds.java
+++ b/src/main/java/me/catcoder/sidebar/protocol/PacketIds.java
@@ -17,7 +17,9 @@ public enum PacketIds {
map(ProtocolConstants.MINECRAFT_1_19_3, 0x56),
map(ProtocolConstants.MINECRAFT_1_19_4, 0x5A),
map(ProtocolConstants.MINECRAFT_1_20_2, 0x5C),
- map(ProtocolConstants.MINECRAFT_1_20_4, 0x5E)
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x5E),
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x5E),
+ map(ProtocolConstants.MINECRAFT_1_20_6, 0x60)
),
UPDATE_SCORE(
map(ProtocolConstants.MINECRAFT_1_12_2, 0x45),
@@ -29,12 +31,14 @@ public enum PacketIds {
map(ProtocolConstants.MINECRAFT_1_19_3, 0x57),
map(ProtocolConstants.MINECRAFT_1_19_4, 0x5B),
map(ProtocolConstants.MINECRAFT_1_20_2, 0x5D),
- map(ProtocolConstants.MINECRAFT_1_20_4, 0x5F)
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x5F),
+ map(ProtocolConstants.MINECRAFT_1_20_6, 0x61)
),
RESET_SCORE(
- map(ProtocolConstants.MINECRAFT_1_20_3, 0x42)
+ map(ProtocolConstants.MINECRAFT_1_20_3, 0x42),
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x44)
),
OBJECTIVE_DISPLAY(
map(ProtocolConstants.MINECRAFT_1_12_2, 0x3B),
@@ -46,7 +50,8 @@ public enum PacketIds {
map(ProtocolConstants.MINECRAFT_1_19_3, 0x4D),
map(ProtocolConstants.MINECRAFT_1_19_4, 0x51),
map(ProtocolConstants.MINECRAFT_1_20_2, 0x53),
- map(ProtocolConstants.MINECRAFT_1_20_4, 0x55)
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x55),
+ map(ProtocolConstants.MINECRAFT_1_20_6, 0x57)
),
OBJECTIVE(
@@ -59,7 +64,8 @@ public enum PacketIds {
map(ProtocolConstants.MINECRAFT_1_19_3, 0x54),
map(ProtocolConstants.MINECRAFT_1_19_4, 0x58),
map(ProtocolConstants.MINECRAFT_1_20_2, 0x5A),
- map(ProtocolConstants.MINECRAFT_1_20_4, 0x5C)
+ map(ProtocolConstants.MINECRAFT_1_20_4, 0x5C),
+ map(ProtocolConstants.MINECRAFT_1_20_6, 0x5E)
);
private final ProtocolConstants.ProtocolMapping[] mappings;
diff --git a/src/main/java/me/catcoder/sidebar/protocol/ProtocolConstants.java b/src/main/java/me/catcoder/sidebar/protocol/ProtocolConstants.java
index c614604..fb6fd25 100644
--- a/src/main/java/me/catcoder/sidebar/protocol/ProtocolConstants.java
+++ b/src/main/java/me/catcoder/sidebar/protocol/ProtocolConstants.java
@@ -41,13 +41,14 @@ public class ProtocolConstants {
public static final int MINECRAFT_1_19_4 = 762;
public static final int MINECRAFT_1_20 = 763;
- public static final int MINECRAFT_1_20_1 = 763;
public static final int MINECRAFT_1_20_2 = 764;
public static final int MINECRAFT_1_20_3 = 765;
public static final int MINECRAFT_1_20_4 = 765;
+ public static final int MINECRAFT_1_20_6 = 766;
+ public static final int MINECRAFT_1_21 = 767;
public static final int MINIMUM_SUPPORTED_VERSION = MINECRAFT_1_12_2;
- public static final int MAXIMUM_SUPPORTED_VERSION = MINECRAFT_1_20_4;
+ public static final int MAXIMUM_SUPPORTED_VERSION = MINECRAFT_1_21;
@Getter
@RequiredArgsConstructor
diff --git a/src/main/java/me/catcoder/sidebar/util/version/MinecraftProtocolVersion.java b/src/main/java/me/catcoder/sidebar/util/version/MinecraftProtocolVersion.java
index 2fd3687..a88ecff 100644
--- a/src/main/java/me/catcoder/sidebar/util/version/MinecraftProtocolVersion.java
+++ b/src/main/java/me/catcoder/sidebar/util/version/MinecraftProtocolVersion.java
@@ -60,6 +60,9 @@ private static NavigableMap createLookup() {
map.put(new MinecraftVersion(1, 20, 2), ProtocolConstants.MINECRAFT_1_20_2);
map.put(new MinecraftVersion(1, 20, 3), ProtocolConstants.MINECRAFT_1_20_3);
+ map.put(new MinecraftVersion(1, 20, 4), ProtocolConstants.MINECRAFT_1_20_4);
+ map.put(new MinecraftVersion(1, 20, 6), ProtocolConstants.MINECRAFT_1_20_6);
+ map.put(new MinecraftVersion(1, 21, 0), ProtocolConstants.MINECRAFT_1_21);
return map;
}