diff --git a/src/main/java/com/velocitypowered/proxy/connection/backend/PlaySessionHandler.java b/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java similarity index 78% rename from src/main/java/com/velocitypowered/proxy/connection/backend/PlaySessionHandler.java rename to src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java index 92a8a56b4..741741b67 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/backend/PlaySessionHandler.java +++ b/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java @@ -1,5 +1,6 @@ package com.velocitypowered.proxy.connection.backend; +import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.packets.Disconnect; import com.velocitypowered.proxy.protocol.packets.JoinGame; @@ -11,10 +12,10 @@ import net.kyori.text.TextComponent; import net.kyori.text.format.TextColor; import net.kyori.text.serializer.ComponentSerializers; -public class PlaySessionHandler implements MinecraftSessionHandler { +public class BackendPlaySessionHandler implements MinecraftSessionHandler { private final ServerConnection connection; - public PlaySessionHandler(ServerConnection connection) { + public BackendPlaySessionHandler(ServerConnection connection) { this.connection = connection; } @@ -34,13 +35,13 @@ public class PlaySessionHandler implements MinecraftSessionHandler { .build(); connection.getProxyPlayer().close(reason); } else if (packet instanceof JoinGame) { - com.velocitypowered.proxy.connection.client.PlaySessionHandler playerHandler = - (com.velocitypowered.proxy.connection.client.PlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler(); + ClientPlaySessionHandler playerHandler = + (ClientPlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler(); playerHandler.handleBackendJoinGame((JoinGame) packet); } else if (packet instanceof Respawn) { // Record the dimension switch, and then forward the packet on. - com.velocitypowered.proxy.connection.client.PlaySessionHandler playerHandler = - (com.velocitypowered.proxy.connection.client.PlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler(); + ClientPlaySessionHandler playerHandler = + (ClientPlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler(); playerHandler.setCurrentDimension(((Respawn) packet).getDimension()); connection.getProxyPlayer().getConnection().write(packet); } else { diff --git a/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java b/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java index 2c84f7572..b4e595aba 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java +++ b/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java @@ -1,5 +1,6 @@ package com.velocitypowered.proxy.connection.backend; +import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packets.Disconnect; @@ -37,12 +38,12 @@ public class LoginSessionHandler implements MinecraftSessionHandler { connection.getChannel().setState(StateRegistry.PLAY); if (connection.getProxyPlayer().getConnectedServer() == null) { // Strap on the play session handler - connection.getProxyPlayer().getConnection().setSessionHandler(new com.velocitypowered.proxy.connection.client.PlaySessionHandler(connection.getProxyPlayer())); + connection.getProxyPlayer().getConnection().setSessionHandler(new ClientPlaySessionHandler(connection.getProxyPlayer())); } else { // The previous server connection should become obsolete. connection.getProxyPlayer().getConnectedServer().disconnect(); } - connection.getChannel().setSessionHandler(new PlaySessionHandler(connection)); + connection.getChannel().setSessionHandler(new BackendPlaySessionHandler(connection)); connection.getProxyPlayer().setConnectedServer(connection); } } diff --git a/src/main/java/com/velocitypowered/proxy/connection/client/PlaySessionHandler.java b/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java similarity index 96% rename from src/main/java/com/velocitypowered/proxy/connection/client/PlaySessionHandler.java rename to src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 69c12a9e1..02dd4ba3b 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/client/PlaySessionHandler.java +++ b/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -17,14 +17,14 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -public class PlaySessionHandler implements MinecraftSessionHandler { +public class ClientPlaySessionHandler implements MinecraftSessionHandler { private final ConnectedPlayer player; private ScheduledFuture pingTask; private long lastPing = -1; private boolean spawned = false; private int currentDimension; - public PlaySessionHandler(ConnectedPlayer player) { + public ClientPlaySessionHandler(ConnectedPlayer player) { this.player = player; }