From 5c6b79537ffded1435ae05a864796e5651124f62 Mon Sep 17 00:00:00 2001 From: hank9999 Date: Wed, 1 May 2024 16:42:05 +0800 Subject: [PATCH] Fix "Invalid payload REGISTER" error when login (#1319) --- .../mixin/bukkit/StandardMessengerMixin.java | 19 +++++++++++++++++++ .../resources/mixins.arclight.bukkit.json | 1 + 2 files changed, 20 insertions(+) create mode 100644 arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/StandardMessengerMixin.java diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/StandardMessengerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/StandardMessengerMixin.java new file mode 100644 index 000000000..300e110ff --- /dev/null +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/StandardMessengerMixin.java @@ -0,0 +1,19 @@ +package io.izzel.arclight.common.mixin.bukkit; + +import org.bukkit.plugin.messaging.Messenger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.bukkit.plugin.messaging.StandardMessenger; + +@Mixin(value=StandardMessenger.class, remap = false) +public abstract class StandardMessengerMixin implements Messenger { + + @ModifyConstant( + method = "validateAndCorrectChannel", + constant = @Constant(intValue = Messenger.MAX_CHANNEL_SIZE) + ) + private static int modifyMaxChannelSize(int original) { + return 256; + } +} \ No newline at end of file diff --git a/arclight-common/src/main/resources/mixins.arclight.bukkit.json b/arclight-common/src/main/resources/mixins.arclight.bukkit.json index 02b63c8b5..3491308d2 100644 --- a/arclight-common/src/main/resources/mixins.arclight.bukkit.json +++ b/arclight-common/src/main/resources/mixins.arclight.bukkit.json @@ -42,6 +42,7 @@ "PluginClassLoaderMixin", "PotionEffectTypeMixin", "RecipeIteratorMixin", + "StandardMessengerMixin", "WatchdogThreadMixin" ] } \ No newline at end of file