9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 16:39:22 +00:00

Fix #61 & Correct case (#62)

This commit is contained in:
DGun Otto
2024-05-22 17:16:36 +08:00
committed by GitHub
parent 7bb67dee00
commit e30198bd9d
2 changed files with 9 additions and 6 deletions

View File

@@ -6,14 +6,14 @@ Subject: [PATCH] Chat Image protocol
This patch is Powered by ChatImage (https://github.com/kitUIN/ChatImage)
diff --git a/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
index be8474a514e7b9bdacd7cc89d8d3e8b3bc3eb709..759b8728f954c2b2725ac2b3f5ffeb495160c7ca 100644
index be8474a514e7b9bdacd7cc89d8d3e8b3bc3eb709..9324ca1f1abd2343b2f1eaec019e84428f01c626 100644
--- a/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
+++ b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
@@ -21,6 +21,9 @@ public class ProtocolSupport implements IConfigModule {
@ConfigInfo(baseName = "appleskin-protocol")
public static boolean appleskinProtocol = false;
+ @ConfigInfo(baseName = "chatImage-protocol")
+ @ConfigInfo(baseName = "chatimage-protocol")
+ public static boolean chatImageProtocol = false;
+
@ConfigInfo(baseName = "xaero-map-protocol")
@@ -21,10 +21,10 @@ index be8474a514e7b9bdacd7cc89d8d3e8b3bc3eb709..759b8728f954c2b2725ac2b3f5ffeb49
@ConfigInfo(baseName = "xaero-map-server-id")
diff --git a/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfbcc4fd836547e6019bc1bc0ac7a3263f0c385a
index 0000000000000000000000000000000000000000..1b829e73e2e000219fb4b44f78ec3f6a1c2824c7
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java
@@ -0,0 +1,157 @@
@@ -0,0 +1,160 @@
+package org.leavesmc.leaves.protocol;
+
+import com.google.common.collect.Lists;
@@ -60,6 +60,7 @@ index 0000000000000000000000000000000000000000..cfbcc4fd836547e6019bc1bc0ac7a326
+ public record FileInfoChannelPacket(String message) implements LeavesCustomPayload<LeavesProtocolManager.LeavesPayload> {
+ private static final ResourceLocation FILE_INFO = ChatImageProtocol.id("file_info");
+
+ @New
+ public FileInfoChannelPacket(ResourceLocation id, FriendlyByteBuf buffer) {
+ this(buffer.readUtf(MAX_STRING));
+ }
@@ -81,6 +82,7 @@ index 0000000000000000000000000000000000000000..cfbcc4fd836547e6019bc1bc0ac7a326
+ */
+ private static final ResourceLocation DOWNLOAD_FILE_CHANNEL = ChatImageProtocol.id("download_file_channel");
+
+ @New
+ public DownloadFileChannelPacket(ResourceLocation id, FriendlyByteBuf buffer) {
+ this(buffer.readUtf(MAX_STRING));
+ }
@@ -103,6 +105,7 @@ index 0000000000000000000000000000000000000000..cfbcc4fd836547e6019bc1bc0ac7a326
+ */
+ private static final ResourceLocation FILE_CHANNEL = ChatImageProtocol.id("file_channel");
+
+ @New
+ public FileChannelPacket(ResourceLocation id, FriendlyByteBuf buffer) {
+ this(buffer.readUtf(MAX_STRING));
+ }