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 abdbfd1dcc..d735989127 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 void connected(ChannelWrapper channel) throws Exception 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 @@ private void cutThrough(ServerConnection server) } 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 9edec4107a..a3879030e0 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -796,4 +796,9 @@ public void transfer(String host, int port) unsafe().sendPacket( new Transfer( host, port ) ); } + + public UUID getRewriteId() + { + return getPendingConnection().getRewriteId(); + } } 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 9965cf361a..5231860199 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 void sendPacket(DefinedPacket packet) @Getter private UUID offlineId; @Getter + private UUID rewriteId; + @Getter private LoginResult loginProfile; @Getter private boolean legacy; @@ -557,6 +559,8 @@ private void finish() uniqueId = offlineId; } + rewriteId = bungee.config.isIpForward() ? uniqueId : offlineId; + if ( BungeeCord.getInstance().config.isEnforceSecureProfile() ) { if ( getVersion() >= ProtocolConstants.MINECRAFT_1_19_1 && getVersion() < ProtocolConstants.MINECRAFT_1_19_3 ) @@ -635,7 +639,7 @@ public void run() 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 f80515d4c3..4dc0315f09 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 void disconnected(ChannelWrapper channel) throws Exception 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 void disconnected(ChannelWrapper channel) throws Exception 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 6db530c3ae..f42dc72244 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 3682212750..dc711f3402 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 38e12ce400..c15ab1a1c8 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 5f29683948..c3e6f8c7d7 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 f3372f0885..c653d664b4 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protoco 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 8210b0a7e3..e9b28f0df1 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protoco 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 c2cf810f34..eafca587d1 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protoco 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 c8b067071d..98b1a15531 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protoco 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 6e0cae636c..0ed7ad6423 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protoco 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 8e2dbe6992..42a5315390 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 d61dc0cbaf..657e584612 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 bfbc84327c..11d8e0e338 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 @@ public void rewriteClientbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) 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 a0baa38844..a982655dd3 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 static PlayerListItemRemove rewrite(PlayerListItemRemove playerListItem) 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 @@ private static void rewrite(PlayerListItem.Item item) UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( item.getUuid() ); if ( player != null ) { - item.setUuid( player.getUniqueId() ); + item.setUuid( player.getRewriteId() ); if ( item.getProperties() != null ) {