From 1be25b6c74ec2be4b15adf8ca53a0497f01e2afe Mon Sep 17 00:00:00 2001 From: Outfluencer <48880402+Outfluencer@users.noreply.github.com> Date: Wed, 17 Apr 2024 21:05:26 +1000 Subject: [PATCH] #3656: Improve online mode support where IP forwarding is disabled --- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 4 ++-- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 5 +++++ .../java/net/md_5/bungee/connection/InitialHandler.java | 5 ++++- .../java/net/md_5/bungee/connection/UpstreamBridge.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_10.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_11.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_12.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_13.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_14.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_15.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_16.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_8.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_9.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java | 8 ++++---- proxy/src/main/java/net/md_5/bungee/tab/TabList.java | 4 ++-- 17 files changed, 63 insertions(+), 55 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index abdbfd1d..d7359891 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -130,7 +130,7 @@ public class ServerConnector extends PacketHandler channel.write( copiedHandshake ); channel.setProtocol( Protocol.LOGIN ); - channel.write( new LoginRequest( user.getName(), null, user.getUniqueId() ) ); + channel.write( new LoginRequest( user.getName(), null, user.getRewriteId() ) ); } @Override @@ -365,7 +365,7 @@ public class ServerConnector extends PacketHandler } else { LoginResult loginProfile = user.getPendingConnection().getLoginProfile(); - user.unsafe().sendPacket( new LoginSuccess( user.getUniqueId(), user.getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); + user.unsafe().sendPacket( new LoginSuccess( user.getRewriteId(), user.getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); user.getCh().setEncodeProtocol( Protocol.CONFIGURATION ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 9edec410..41670a16 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -642,6 +642,11 @@ public final class UserConnection implements ProxiedPlayer return getPendingConnection().getUniqueId(); } + public UUID getRewriteId() + { + return getPendingConnection().getRewriteId(); + } + public void setSettings(ClientSettings settings) { this.settings = settings; diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 9965cf36..1d9a9ee5 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -126,6 +126,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection @Getter private UUID offlineId; @Getter + private UUID rewriteId; + @Getter private LoginResult loginProfile; @Getter private boolean legacy; @@ -556,6 +558,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection { uniqueId = offlineId; } + rewriteId = ( bungee.config.isIpForward() ) ? uniqueId : offlineId; if ( BungeeCord.getInstance().config.isEnforceSecureProfile() ) { @@ -635,7 +638,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection if ( getVersion() < ProtocolConstants.MINECRAFT_1_20_2 ) { - unsafe.sendPacket( new LoginSuccess( getUniqueId(), getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); + unsafe.sendPacket( new LoginSuccess( getRewriteId(), getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); ch.setProtocol( Protocol.GAME ); } finish2(); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java index f80515d4..4dc0315f 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java @@ -85,7 +85,7 @@ public class UpstreamBridge extends PacketHandler PlayerListItem oldPacket = new PlayerListItem(); oldPacket.setAction( PlayerListItem.Action.REMOVE_PLAYER ); PlayerListItem.Item item = new PlayerListItem.Item(); - item.setUuid( con.getUniqueId() ); + item.setUuid( con.getRewriteId() ); oldPacket.setItems( new PlayerListItem.Item[] { item @@ -94,7 +94,7 @@ public class UpstreamBridge extends PacketHandler PlayerListItemRemove newPacket = new PlayerListItemRemove(); newPacket.setUuids( new UUID[] { - con.getUniqueId() + con.getRewriteId() } ); for ( ProxiedPlayer player : con.getServer().getInfo().getPlayers() ) diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java index 6db530c3..f42dc722 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java @@ -121,13 +121,13 @@ class EntityMap_1_10 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -164,7 +164,7 @@ class EntityMap_1_10 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -173,7 +173,7 @@ class EntityMap_1_10 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java index 36822127..dc711f34 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java @@ -121,13 +121,13 @@ class EntityMap_1_11 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -165,7 +165,7 @@ class EntityMap_1_11 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -174,7 +174,7 @@ class EntityMap_1_11 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java index 38e12ce4..c15ab1a1 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java @@ -121,13 +121,13 @@ class EntityMap_1_12 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -165,7 +165,7 @@ class EntityMap_1_12 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1E /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1E /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -174,7 +174,7 @@ class EntityMap_1_12 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java index 5f296839..c3e6f8c7 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java @@ -121,13 +121,13 @@ class EntityMap_1_12_1 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -165,7 +165,7 @@ class EntityMap_1_12_1 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1E /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1E /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -174,7 +174,7 @@ class EntityMap_1_12_1 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java index f3372f08..c653d664 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java @@ -121,13 +121,13 @@ class EntityMap_1_13 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -165,7 +165,7 @@ class EntityMap_1_13 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x28 /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x28 /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -174,7 +174,7 @@ class EntityMap_1_13 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java index 8210b0a7..e9b28f0d 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java @@ -120,13 +120,13 @@ class EntityMap_1_14 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -169,7 +169,7 @@ class EntityMap_1_14 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x2B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x2B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -178,7 +178,7 @@ class EntityMap_1_14 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java index c2cf810f..eafca587 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java @@ -120,13 +120,13 @@ class EntityMap_1_15 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -169,7 +169,7 @@ class EntityMap_1_15 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x2B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x2B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -178,7 +178,7 @@ class EntityMap_1_15 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java index c8b06707..98b1a155 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java @@ -120,13 +120,13 @@ class EntityMap_1_16 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -169,7 +169,7 @@ class EntityMap_1_16 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x2C /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x2C /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -178,7 +178,7 @@ class EntityMap_1_16 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java index 6e0cae63..0ed7ad64 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java @@ -41,13 +41,13 @@ class EntityMap_1_16_2 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } } @@ -62,7 +62,7 @@ class EntityMap_1_16_2 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == spectateId && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == spectateId ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -71,7 +71,7 @@ class EntityMap_1_16_2 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java index 8e2dbe69..42a53153 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java @@ -121,13 +121,13 @@ class EntityMap_1_8 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } } else if ( packetId == 0x42 /* Combat Event */ ) @@ -158,7 +158,7 @@ class EntityMap_1_8 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x18 /* Spectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x18 /* Spectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -167,7 +167,7 @@ class EntityMap_1_8 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java index d61dc0cb..657e5846 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java @@ -121,13 +121,13 @@ class EntityMap_1_9 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -164,7 +164,7 @@ class EntityMap_1_9 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -173,7 +173,7 @@ class EntityMap_1_9 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java index bfbc8432..11d8e0e3 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java @@ -121,13 +121,13 @@ class EntityMap_1_9_4 extends EntityMap DefinedPacket.readVarInt( packet ); // Entity ID int idLength = packet.readerIndex() - readerIndex - packetIdLength; UUID uuid = DefinedPacket.readUUID( packet ); - ProxiedPlayer player; + UserConnection player; if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null ) { int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength + idLength ); - DefinedPacket.writeUUID( player.getUniqueId(), packet ); + DefinedPacket.writeUUID( player.getRewriteId(), packet ); packet.writerIndex( previous ); } break; @@ -164,7 +164,7 @@ class EntityMap_1_9_4 extends EntityMap int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() ) + if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; @@ -173,7 +173,7 @@ class EntityMap_1_9_4 extends EntityMap int previous = packet.writerIndex(); packet.readerIndex( readerIndex ); packet.writerIndex( readerIndex + packetIdLength ); - DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet ); + DefinedPacket.writeUUID( ( (UserConnection) player ).getRewriteId(), packet ); packet.writerIndex( previous ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/tab/TabList.java b/proxy/src/main/java/net/md_5/bungee/tab/TabList.java index a0baa388..a982655d 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/TabList.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/TabList.java @@ -46,7 +46,7 @@ public abstract class TabList UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( playerListItem.getUuids()[i] ); if ( player != null ) { - playerListItem.getUuids()[i] = player.getUniqueId(); + playerListItem.getUuids()[i] = player.getRewriteId(); } } @@ -72,7 +72,7 @@ public abstract class TabList UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( item.getUuid() ); if ( player != null ) { - item.setUuid( player.getUniqueId() ); + item.setUuid( player.getRewriteId() ); if ( item.getProperties() != null ) {