diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerHandshakeNetHandlerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerHandshakeNetHandlerMixin.java index 55da5862a..4bbd0b58d 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerHandshakeNetHandlerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerHandshakeNetHandlerMixin.java @@ -16,7 +16,6 @@ import net.minecraft.server.network.ServerHandshakePacketListenerImpl; import net.minecraft.server.network.ServerLoginPacketListenerImpl; import net.minecraft.server.network.ServerStatusPacketListenerImpl; -import net.minecraftforge.network.NetworkContext; import net.minecraftforge.server.ServerLifecycleHooks; import org.apache.logging.log4j.LogManager; import org.bukkit.Bukkit; @@ -143,11 +142,7 @@ public void handleIntention(ClientIntentionPacket packetIn) { private boolean arclight$handleSpecialLogin(ClientIntentionPacket packet) { String ip = packet.hostName(); - if (VelocitySupport.isEnabled()) { - // as if forge client connects - var forgePacket = new ClientIntentionPacket(packet.protocolVersion(), NetworkContext.enhanceHostName(ip), packet.port(), packet.intention()); - return ServerLifecycleHooks.handleServerLogin(forgePacket, this.connection); - } else if (SpigotConfig.bungee) { + if (!VelocitySupport.isEnabled() && SpigotConfig.bungee) { String[] split = ip.split("\0"); if (split.length == 4) { Property[] properties = GSON.fromJson(split[3], Property[].class); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerLoginNetHandlerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerLoginNetHandlerMixin.java index eb57fa793..e3f0ed533 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerLoginNetHandlerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerLoginNetHandlerMixin.java @@ -31,10 +31,6 @@ import net.minecraft.util.CryptException; import net.minecraft.world.entity.player.Player; import net.minecraftforge.fml.util.thread.SidedThreadGroups; -import net.minecraftforge.network.ConnectionType; -import net.minecraftforge.network.NetworkContext; -import net.minecraftforge.network.NetworkRegistry; -import net.minecraftforge.network.filters.NetworkFilters; import org.apache.commons.lang3.Validate; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v.CraftServer; @@ -257,8 +253,6 @@ private InetAddress getAddress() { thread.start(); } - private static final String EXTRA_DATA = "extraData"; - @Inject(method = "handleCustomQueryPacket", cancellable = true, at = @At("HEAD")) private void arclight$modernForwardReply(ServerboundCustomQueryAnswerPacket packet, CallbackInfo ci) { if (VelocitySupport.isEnabled() && packet.transactionId() == this.arclight$velocityLoginId) { @@ -299,40 +293,6 @@ private InetAddress getAddress() { this.connection.address = new java.net.InetSocketAddress(VelocitySupport.readAddress(buf), port); this.authenticatedProfile = VelocitySupport.createProfile(buf); - // late forge setup - boolean forwarded = false; - for (var property : this.authenticatedProfile.getProperties().values()) { - if (Objects.equals(property.name(), EXTRA_DATA)) { - String extraData = property.value().replace("\1", "\0"); - var ctx = NetworkContext.get(this.connection); - ctx.processIntention(extraData); - if (ctx.getType() == ConnectionType.MODDED && ctx.getNetVersion() != NetworkContext.NET_VERSION) { - this.disconnect("This modded server is not impl compatible with your modded client. Please verify your Forge version closely matches the server. Got net version " + ctx.getNetVersion() + " this server is net version " + NetworkContext.NET_VERSION); - ci.cancel(); - return; - } - if (ctx.getType() == ConnectionType.VANILLA && !NetworkRegistry.acceptsVanillaClientConnections()) { - this.disconnect("This server has mods that require Forge to be installed on the client. Contact your server admin for more details."); - ci.cancel(); - return; - } - NetworkFilters.injectIfNecessary(this.connection); - forwarded = true; - break; - } - } - if (!forwarded) { - // considered vanilla - var ctx = NetworkContext.get(this.connection); - ctx.processIntention(""); - if (ctx.getType() == ConnectionType.VANILLA && !NetworkRegistry.acceptsVanillaClientConnections()) { - this.disconnect("This server has mods that require Forge to be installed on the client. Contact your server admin for more details."); - ci.cancel(); - return; - } - NetworkFilters.injectIfNecessary(this.connection); - } - // Proceed with login Util.backgroundExecutor().execute(() -> { try {