13
0
geforkt von Mirrors/Velocity

Fix some assorted stuff.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-26 17:31:53 -04:00
Ursprung 6ae9798a1b
Commit 41af775cc6
3 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -5,6 +5,7 @@ import com.velocitypowered.proxy.protocol.packets.Disconnect;
import com.velocitypowered.proxy.protocol.packets.JoinGame; import com.velocitypowered.proxy.protocol.packets.JoinGame;
import com.velocitypowered.proxy.protocol.packets.Ping; import com.velocitypowered.proxy.protocol.packets.Ping;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.packets.Respawn;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.kyori.text.TextComponent; import net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor; import net.kyori.text.format.TextColor;
@ -36,6 +37,12 @@ public class PlaySessionHandler implements MinecraftSessionHandler {
com.velocitypowered.proxy.connection.client.PlaySessionHandler playerHandler = com.velocitypowered.proxy.connection.client.PlaySessionHandler playerHandler =
(com.velocitypowered.proxy.connection.client.PlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler(); (com.velocitypowered.proxy.connection.client.PlaySessionHandler) connection.getProxyPlayer().getConnection().getSessionHandler();
playerHandler.handleBackendJoinGame((JoinGame) packet); 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();
playerHandler.setCurrentDimension(((Respawn) packet).getDimension());
connection.getProxyPlayer().getConnection().write(packet);
} else { } else {
// Just forward the packet on. We don't have anything to handle at this time. // Just forward the packet on. We don't have anything to handle at this time.
connection.getProxyPlayer().getConnection().write(packet); connection.getProxyPlayer().getConnection().write(packet);

Datei anzeigen

@ -60,7 +60,8 @@ public class ServerConnection {
// Velocity doesn't yet support online-mode, unfortunately. That will come soon. // Velocity doesn't yet support online-mode, unfortunately. That will come soon.
return serverInfo.getAddress().getHostString() + "\0" + return serverInfo.getAddress().getHostString() + "\0" +
proxyPlayer.getRemoteAddress().getHostString() + "\0" + proxyPlayer.getRemoteAddress().getHostString() + "\0" +
UuidUtils.toUndashed(proxyPlayer.getUniqueId()); UuidUtils.toUndashed(proxyPlayer.getUniqueId()) + "\0" +
"[]";
} }
private void startHandshake() { private void startHandshake() {

Datei anzeigen

@ -47,7 +47,7 @@ public class PlaySessionHandler implements MinecraftSessionHandler {
if (packet instanceof Ping) { if (packet instanceof Ping) {
Ping ping = (Ping) packet; Ping ping = (Ping) packet;
if (ping.getRandomId() != lastPing) { if (ping.getRandomId() != lastPing) {
// throw new IllegalStateException("Client sent invalid ping; expected " + lastPing + ", got " + ping.getRandomId()); throw new IllegalStateException("Client sent invalid ping; expected " + lastPing + ", got " + ping.getRandomId());
} }
// Do not forward the packet to the player's server, because we handle pings for all servers already. // Do not forward the packet to the player's server, because we handle pings for all servers already.
@ -102,4 +102,8 @@ public class PlaySessionHandler implements MinecraftSessionHandler {
currentDimension = joinGame.getDimension(); currentDimension = joinGame.getDimension();
} }
} }
public void setCurrentDimension(int currentDimension) {
this.currentDimension = currentDimension;
}
} }