Small fix and refactoring

This commit is contained in:
Adrian Bergqvist 2023-02-17 13:38:15 +01:00
parent 14d4c6d5bc
commit e690ead1eb
No known key found for this signature in database
GPG Key ID: FAE7D8EDE225E686
12 changed files with 14 additions and 42 deletions

View File

@ -1,14 +1,5 @@
package org.adde0109.ambassador.forge;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import net.kyori.adventure.text.Component;
import org.adde0109.ambassador.Ambassador;
import org.adde0109.ambassador.velocity.VelocityForgeClientConnectionPhase;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
public class FML2ClientConnectionPhase {
/*

View File

@ -5,8 +5,6 @@ import com.velocitypowered.proxy.config.PlayerInfoForwarding;
import com.velocitypowered.proxy.connection.ConnectionType;
import com.velocitypowered.proxy.connection.backend.BackendConnectionPhase;
import com.velocitypowered.proxy.connection.client.ClientConnectionPhase;
import org.adde0109.ambassador.velocity.VelocityForgeClientConnectionPhase;
import org.adde0109.ambassador.velocity.backend.VelocityForgeBackendConnectionPhase;
import java.util.Collections;

View File

@ -3,25 +3,8 @@ package org.adde0109.ambassador.forge;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.api.util.ModInfo;
import java.util.*;
import com.velocitypowered.api.util.UuidUtils;
import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.config.PlayerInfoForwarding;
import com.velocitypowered.proxy.config.VelocityConfiguration;
import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess;
import io.netty.buffer.ByteBuf;
import org.adde0109.ambassador.velocity.VelocityForgeHandshakeSessionHandler;
import org.slf4j.Logger;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
public class ForgeHandshakeUtils {

View File

@ -1,11 +1,10 @@
package org.adde0109.ambassador.velocity.backend;
package org.adde0109.ambassador.forge;
import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.backend.BackendConnectionPhase;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage;
import org.adde0109.ambassador.velocity.VelocityForgeClientConnectionPhase;
public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhase {
NOT_STARTED() {

View File

@ -1,4 +1,4 @@
package org.adde0109.ambassador.velocity;
package org.adde0109.ambassador.forge;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.proxy.VelocityServer;
@ -13,12 +13,10 @@ import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import io.netty.buffer.Unpooled;
import net.kyori.adventure.text.Component;
import org.adde0109.ambassador.Ambassador;
import org.adde0109.ambassador.forge.FML2CRPMResetCompleteDecoder;
import org.adde0109.ambassador.forge.ForgeConstants;
import org.adde0109.ambassador.forge.ForgeFMLConnectionType;
import org.adde0109.ambassador.forge.ForgeHandshakeUtils;
import org.adde0109.ambassador.velocity.client.FML2CRPMResetCompleteDecoder;
import org.adde0109.ambassador.velocity.client.OutboundForgeHandshakeHolder;
import org.adde0109.ambassador.velocity.client.OutboundSuccessHolder;
import org.adde0109.ambassador.velocity.client.VelocityForgeHandshakeSessionHandler;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ScheduledFuture;

View File

@ -10,6 +10,8 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.StateRegistry;
import org.adde0109.ambassador.Ambassador;
import org.adde0109.ambassador.forge.VelocityForgeClientConnectionPhase;
import org.adde0109.ambassador.velocity.client.VelocityForgeHandshakeSessionHandler;
public class VelocityEventHandler {

View File

@ -8,6 +8,7 @@ import com.velocitypowered.proxy.network.ServerChannelInitializer;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import org.adde0109.ambassador.velocity.client.VelocityHandshakeSessionHandler;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Method;

View File

@ -13,6 +13,7 @@ import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess;
import net.kyori.adventure.text.Component;
import org.adde0109.ambassador.forge.ForgeConstants;
import org.adde0109.ambassador.forge.ForgeFMLConnectionType;
import org.adde0109.ambassador.forge.VelocityForgeBackendConnectionPhase;
import org.adde0109.ambassador.velocity.client.OutboundSuccessHolder;
public class ForgeLoginSessionHandler implements MinecraftSessionHandler {
@ -47,7 +48,7 @@ public class ForgeLoginSessionHandler implements MinecraftSessionHandler {
}
ConnectedPlayer player = serverConnection.getPlayer();
if (!(serverConnection.getConnection().getType() instanceof ForgeFMLConnectionType)) {
if (!(serverConnection.getConnection().getType() instanceof ForgeFMLConnectionType) && player.getConnectedServer() != null) {
player.getPhase().resetConnectionPhase(player);
} else {
MinecraftConnection connection = player.getConnection();

View File

@ -5,7 +5,7 @@ import com.velocitypowered.proxy.connection.backend.TransitionSessionHandler;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.packet.JoinGame;
import org.adde0109.ambassador.velocity.VelocityForgeClientConnectionPhase;
import org.adde0109.ambassador.forge.VelocityForgeClientConnectionPhase;
public class ForgePlaySessionHandler implements MinecraftSessionHandler {

View File

@ -1,4 +1,4 @@
package org.adde0109.ambassador.forge;
package org.adde0109.ambassador.velocity.client;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils;

View File

@ -1,11 +1,10 @@
package org.adde0109.ambassador.velocity;
package org.adde0109.ambassador.velocity.client;
import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse;
import io.netty.buffer.ByteBuf;
import org.adde0109.ambassador.forge.VelocityForgeClientConnectionPhase;
public class VelocityForgeHandshakeSessionHandler implements MinecraftSessionHandler {
private final MinecraftSessionHandler original;

View File

@ -1,4 +1,4 @@
package org.adde0109.ambassador.velocity;
package org.adde0109.ambassador.velocity.client;
import com.velocitypowered.proxy.connection.ConnectionTypes;
import com.velocitypowered.proxy.connection.MinecraftConnection;