From 885130f33952e2d9785ecfa4a0e0fc59501d0099 Mon Sep 17 00:00:00 2001 From: CaaMoe Date: Wed, 23 Oct 2024 14:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20velocity=20api=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC,=20=E7=A7=BB=E9=99=A4=E7=83=82=E7=9A=84=20chat=20sess?= =?UTF-8?q?ion=20blocker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- velocity/build.gradle | 8 +------- velocity/injector/build.gradle | 10 ++-------- .../velocity/injector/VelocityInjector.java | 15 --------------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/velocity/build.gradle b/velocity/build.gradle index e5673eb4..02138ab0 100644 --- a/velocity/build.gradle +++ b/velocity/build.gradle @@ -21,14 +21,8 @@ dependencies { compileOnly fileTree(dir: 'libraries', include: ['*.jar']) compileOnly 'io.netty:netty-all:4.1.86.Final' - compileOnly 'net.minecrell:terminalconsoleappender:1.3.0' - -// 下面是用来补充proxy引用的 为自编译库 如果不可用清参照libraries下README.MD -// compileOnly 'com.velocitypowered:velocity-proxy:3.2.0' - - compileOnly 'com.velocitypowered:velocity-api:3.1.0' -// annotationProcessor 'com.velocitypowered:velocity-api:3.1.0' + compileOnly 'com.velocitypowered:velocity-api:3.4.0-SNAPSHOT' } diff --git a/velocity/injector/build.gradle b/velocity/injector/build.gradle index 82e64f22..59f85994 100644 --- a/velocity/injector/build.gradle +++ b/velocity/injector/build.gradle @@ -21,15 +21,9 @@ dependencies { compileOnly fileTree(dir: './../libraries', include: ['*.jar']) compileOnly 'io.netty:netty-all:4.1.86.Final' - compileOnly 'net.minecrell:terminalconsoleappender:1.3.0' - - compileOnly 'com.velocitypowered:velocity-api:3.1.0' -// 下面两条是用来补充3.1.0中缺少的API以及必须的proxy引用的 为自编译库 如果不可用清参照libraries下README.MD -// compileOnly 'com.velocitypowered:velocity-proxy:3.2.0' -// compileOnly 'com.velocitypowered:velocity-api-add:3.2.0' - - annotationProcessor 'com.velocitypowered:velocity-api:3.1.0' + compileOnly 'com.velocitypowered:velocity-api:3.4.0-SNAPSHOT' + annotationProcessor 'com.velocitypowered:velocity-api:3.4.0-SNAPSHOT' } shadowJar { diff --git a/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/VelocityInjector.java b/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/VelocityInjector.java index 8948306f..328f4d73 100644 --- a/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/VelocityInjector.java +++ b/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/VelocityInjector.java @@ -6,14 +6,12 @@ import com.velocitypowered.proxy.protocol.packet.EncryptionResponsePacket; import com.velocitypowered.proxy.protocol.packet.ServerLoginPacket; import moe.caa.multilogin.api.internal.injector.Injector; -import moe.caa.multilogin.api.internal.logger.LoggerProvider; import moe.caa.multilogin.api.internal.main.MultiCoreAPI; import moe.caa.multilogin.api.internal.util.reflect.NoSuchEnumException; import moe.caa.multilogin.api.internal.util.reflect.ReflectUtil; import moe.caa.multilogin.velocity.injector.handler.MultiInitialLoginSessionHandler; import moe.caa.multilogin.velocity.injector.redirect.auth.MultiEncryptionResponse; import moe.caa.multilogin.velocity.injector.redirect.auth.MultiServerLogin; -import moe.caa.multilogin.velocity.injector.redirect.chat.PlayerSessionPacketBlocker; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -38,19 +36,6 @@ public void inject(MultiCoreAPI multiCoreAPI) throws NoSuchFieldException, Class redirectInput(serverbound, EncryptionResponsePacket.class, () -> new MultiEncryptionResponse(multiCoreAPI)); redirectInput(serverbound, ServerLoginPacket.class, () -> new MultiServerLogin(multiCoreAPI)); } - - // chat - try { - StateRegistry.PacketRegistry serverbound = getServerboundPacketRegistry(StateRegistry.PLAY); - StateRegistry.PacketMapping[] playerSessionPacketMapping = { - createPacketMapping(0x20, ProtocolVersion.MINECRAFT_1_19_3, false), - createPacketMapping(0x06, ProtocolVersion.MINECRAFT_1_19_4, false), - createPacketMapping(0x07, ProtocolVersion.MINECRAFT_1_20_5, false) - }; - registerPacket(serverbound, PlayerSessionPacketBlocker.class, PlayerSessionPacketBlocker::new, playerSessionPacketMapping); - } catch (Throwable throwable){ - LoggerProvider.getLogger().error("Unable to register PlayerSessionPacketBlocker, chat session blocker does not work as expected.", throwable); - } } private StateRegistry.PacketRegistry getServerboundPacketRegistry(StateRegistry stateRegistry) throws NoSuchFieldException, IllegalAccessException {