Skip to content

Commit

Permalink
更新 velocity api 版本, 移除烂的 chat session blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
CaaMoe committed Oct 23, 2024
1 parent cf77f53 commit 885130f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
8 changes: 1 addition & 7 deletions velocity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}


Expand Down
10 changes: 2 additions & 8 deletions velocity/injector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit 885130f

Please sign in to comment.