geforkt von Mirrors/Velocity
Rename the two PlaySessionHandler classes to more clear names.
Dieser Commit ist enthalten in:
Ursprung
41af775cc6
Commit
ba5d6ad6e2
@ -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 {
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren