From 0ee6a89c2fefdbda9cff9a0f68a25cf560310215 Mon Sep 17 00:00:00 2001 From: CaaMoe Date: Thu, 20 Jun 2024 09:22:47 +0800 Subject: [PATCH 1/2] Remove SignatureValidator. --- .../caa/multilogin/bukkit/injector/BukkitInjector.kt | 10 +++++----- .../injector/redirect/auth/MultiServerLogin.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bukkit/injector/src/main/kotlin/moe/caa/multilogin/bukkit/injector/BukkitInjector.kt b/bukkit/injector/src/main/kotlin/moe/caa/multilogin/bukkit/injector/BukkitInjector.kt index e285225a..07c7152d 100644 --- a/bukkit/injector/src/main/kotlin/moe/caa/multilogin/bukkit/injector/BukkitInjector.kt +++ b/bukkit/injector/src/main/kotlin/moe/caa/multilogin/bukkit/injector/BukkitInjector.kt @@ -76,11 +76,11 @@ class BukkitInjector : Injector { modified = true } else if (signatureValidatorClass != null && anyPair.second.javaClass.name.contains("SignatureValidator")) { // 替换SignatureValidator - anyPair.second = Proxy.newProxyInstance( - Thread.currentThread().contextClassLoader, - arrayOf(signatureValidatorClass), - SignatureValidatorInvocationHandler(anyPair.second) - ) +// anyPair.second = Proxy.newProxyInstance( +// Thread.currentThread().contextClassLoader, +// arrayOf(signatureValidatorClass), +// SignatureValidatorInvocationHandler(anyPair.second) +// ) } } diff --git a/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/redirect/auth/MultiServerLogin.java b/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/redirect/auth/MultiServerLogin.java index 5e7fad31..f4dcc659 100644 --- a/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/redirect/auth/MultiServerLogin.java +++ b/velocity/injector/src/main/java/moe/caa/multilogin/velocity/injector/redirect/auth/MultiServerLogin.java @@ -18,11 +18,11 @@ public class MultiServerLogin extends ServerLoginPacket { @Override public boolean handle(MinecraftSessionHandler handler) { - if (getPlayerKey() != null) { - setPlayerKey((IdentifiedKey) Proxy.newProxyInstance( - Thread.currentThread().getContextClassLoader(), - new Class[]{IdentifiedKey.class}, new IdentifiedKeyInvocationHandler(getPlayerKey()))); - } +// if (getPlayerKey() != null) { +// setPlayerKey((IdentifiedKey) Proxy.newProxyInstance( +// Thread.currentThread().getContextClassLoader(), +// new Class[]{IdentifiedKey.class}, new IdentifiedKeyInvocationHandler(getPlayerKey()))); +// } return super.handle(handler); } From 17009b1b23edd6085aa1b92a7f558f2ce2c1ee4f Mon Sep 17 00:00:00 2001 From: CaaMoe Date: Thu, 20 Jun 2024 09:23:01 +0800 Subject: [PATCH 2/2] re always apply bedrock skin. --- .../FloodgateAuthenticationService.java | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/moe/caa/multilogin/core/auth/service/floodgate/FloodgateAuthenticationService.java b/core/src/main/java/moe/caa/multilogin/core/auth/service/floodgate/FloodgateAuthenticationService.java index 19db9bbe..607ce1ce 100644 --- a/core/src/main/java/moe/caa/multilogin/core/auth/service/floodgate/FloodgateAuthenticationService.java +++ b/core/src/main/java/moe/caa/multilogin/core/auth/service/floodgate/FloodgateAuthenticationService.java @@ -1,10 +1,6 @@ package moe.caa.multilogin.core.auth.service.floodgate; -import lombok.SneakyThrows; import moe.caa.multilogin.api.internal.auth.AuthResult; -import moe.caa.multilogin.api.internal.logger.Logger; -import moe.caa.multilogin.api.internal.logger.LoggerProvider; -import moe.caa.multilogin.api.internal.util.reflect.ReflectUtil; import moe.caa.multilogin.api.profile.GameProfile; import moe.caa.multilogin.api.internal.util.ValueUtil; import moe.caa.multilogin.core.auth.LoginAuthResult; @@ -16,34 +12,51 @@ import org.geysermc.event.subscribe.Subscriber; import org.geysermc.event.subscribe.impl.SubscriberImpl; import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.event.PostOrder; +import org.geysermc.event.subscribe.Subscriber; +import org.geysermc.event.subscribe.impl.SubscriberImpl; +import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.InstanceHolder; import org.geysermc.floodgate.api.event.FloodgateEventBus; import org.geysermc.floodgate.api.event.skin.SkinApplyEvent; +import org.geysermc.floodgate.api.event.skin.SkinApplyEvent; import org.geysermc.floodgate.api.handshake.HandshakeData; import org.geysermc.floodgate.api.handshake.HandshakeHandler; import org.geysermc.floodgate.util.BedrockData; import org.geysermc.floodgate.util.LinkedPlayer; import java.lang.reflect.Field; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.HashMap; import java.util.UUID; +import java.util.function.Consumer; public class FloodgateAuthenticationService implements HandshakeHandler { private final MultiCore multiCore; public FloodgateAuthenticationService(MultiCore multiCore) { this.multiCore = multiCore; + } + - FloodgateApi.getInstance().getEventBus().subscribe(SkinApplyEvent.class, event -> { - if(!multiCore.getPluginConfig().isFloodgateSupport()) return; + @Subscribe(postOrder = PostOrder.FIRST) + public void onSkinApply(SkinApplyEvent event){ + if(!multiCore.getPluginConfig().isFloodgateSupport()) return; + + // always apply bedrock skin. + event.setCancelled(false); + } - // always apply bedrock skin. - event.setCancelled(false); - }, PostOrder.FIRST); + @Subscribe(ignoreCancelled = true, postOrder = PostOrder.FIRST) + public void onSkinApplyIgnoreCancelled(SkinApplyEvent event){ + onSkinApply(event); } public void register() { InstanceHolder.getHandshakeHandlers().addHandshakeHandler(this); + FloodgateApi.getInstance().getEventBus().register(this); } @Override