From 162bc1a41bacc9a30ca2e7d37d9cdfba060a6e38 Mon Sep 17 00:00:00 2001 From: Outfluencer Date: Tue, 16 Apr 2024 03:33:03 -0700 Subject: [PATCH 1/2] use rewriteId --- 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 | 6 +++++- .../java/net/md_5/bungee/connection/UpstreamBridge.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_10.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_11.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_12.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_13.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_14.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_15.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_16.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java | 8 ++++---- .../java/net/md_5/bungee/entitymap/EntityMap_1_8.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_9.java | 4 ++-- .../java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java | 4 ++-- proxy/src/main/java/net/md_5/bungee/tab/TabList.java | 4 ++-- 17 files changed, 42 insertions(+), 33 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 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..c826abf5ad 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; 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..8ab34916fa 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; 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..b12ad7f04e 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; 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..4069dcecfd 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; 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..c093dc1c29 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; 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..140d7094ca 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; 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..c3425ac3aa 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; 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..83bfcd415c 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; 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..bf5d2c2589 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 */ ) 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..80b1f32690 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; 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..974f25e28c 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; 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 ) { From b85ef928af81b5b60c5ef35a1dc742b0d838ff2b Mon Sep 17 00:00:00 2001 From: Outfluencer <48880402+Outfluencer@users.noreply.github.com> Date: Wed, 17 Apr 2024 03:15:16 -0700 Subject: [PATCH 2/2] use rewriterId for all spectate packet rewrites (#3) --- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java | 4 ++-- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) 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 c826abf5ad..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 @@ -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 8ab34916fa..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 @@ -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 b12ad7f04e..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 @@ -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 4069dcecfd..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 @@ -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 c093dc1c29..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 @@ -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 140d7094ca..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 @@ -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 c3425ac3aa..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 @@ -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 83bfcd415c..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 @@ -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_8.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java index bf5d2c2589..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 @@ -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 80b1f32690..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 @@ -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 974f25e28c..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 @@ -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 ); } }