Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 23:30:26 +01:00
Fix some assorted stuff.
Dieser Commit ist enthalten in:
Ursprung
6ae9798a1b
Commit
41af775cc6
@ -5,6 +5,7 @@ import com.velocitypowered.proxy.protocol.packets.Disconnect;
|
||||
import com.velocitypowered.proxy.protocol.packets.JoinGame;
|
||||
import com.velocitypowered.proxy.protocol.packets.Ping;
|
||||
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
||||
import com.velocitypowered.proxy.protocol.packets.Respawn;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.kyori.text.TextComponent;
|
||||
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) 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();
|
||||
playerHandler.setCurrentDimension(((Respawn) packet).getDimension());
|
||||
connection.getProxyPlayer().getConnection().write(packet);
|
||||
} else {
|
||||
// Just forward the packet on. We don't have anything to handle at this time.
|
||||
connection.getProxyPlayer().getConnection().write(packet);
|
||||
|
@ -60,7 +60,8 @@ public class ServerConnection {
|
||||
// Velocity doesn't yet support online-mode, unfortunately. That will come soon.
|
||||
return serverInfo.getAddress().getHostString() + "\0" +
|
||||
proxyPlayer.getRemoteAddress().getHostString() + "\0" +
|
||||
UuidUtils.toUndashed(proxyPlayer.getUniqueId());
|
||||
UuidUtils.toUndashed(proxyPlayer.getUniqueId()) + "\0" +
|
||||
"[]";
|
||||
}
|
||||
|
||||
private void startHandshake() {
|
||||
|
@ -47,7 +47,7 @@ public class PlaySessionHandler implements MinecraftSessionHandler {
|
||||
if (packet instanceof Ping) {
|
||||
Ping ping = (Ping) packet;
|
||||
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.
|
||||
@ -102,4 +102,8 @@ public class PlaySessionHandler implements MinecraftSessionHandler {
|
||||
currentDimension = joinGame.getDimension();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentDimension(int currentDimension) {
|
||||
this.currentDimension = currentDimension;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren