From b91d4d3003cef9087d1f379c6b4cea5e40698038 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 22 Apr 2020 11:49:33 +1000 Subject: [PATCH] #2820: Sending a player via /send prints incorrect message --- .../md_5/bungee/module/cmd/send/CommandSend.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/module/cmd-send/src/main/java/net/md_5/bungee/module/cmd/send/CommandSend.java b/module/cmd-send/src/main/java/net/md_5/bungee/module/cmd/send/CommandSend.java index 4ca18d9e..b88298ab 100644 --- a/module/cmd-send/src/main/java/net/md_5/bungee/module/cmd/send/CommandSend.java +++ b/module/cmd-send/src/main/java/net/md_5/bungee/module/cmd/send/CommandSend.java @@ -64,11 +64,13 @@ public class CommandSend extends Command implements TabExecutor { private final SendCallback callback; - private final ProxiedPlayer target; + private final ProxiedPlayer player; + private final ServerInfo target; - public Entry(SendCallback callback, ProxiedPlayer target) + public Entry(SendCallback callback, ProxiedPlayer player, ServerInfo target) { this.callback = callback; + this.player = player; this.target = target; this.callback.count++; } @@ -76,10 +78,10 @@ public class CommandSend extends Command implements TabExecutor @Override public void done(ServerConnectRequest.Result result, Throwable error) { - callback.results.get( result ).add( target.getName() ); + callback.results.get( result ).add( player.getName() ); if ( result == ServerConnectRequest.Result.SUCCESS ) { - target.sendMessage( ProxyServer.getInstance().getTranslation( "you_got_summoned", target.getName(), callback.sender.getName() ) ); + player.sendMessage( ProxyServer.getInstance().getTranslation( "you_got_summoned", target.getName(), callback.sender.getName() ) ); } if ( --callback.count == 0 ) @@ -146,13 +148,13 @@ public class CommandSend extends Command implements TabExecutor Iterator iterator = targets.iterator(); while ( iterator.hasNext() ) { - ProxiedPlayer target = iterator.next(); + ProxiedPlayer player = iterator.next(); ServerConnectRequest request = ServerConnectRequest.builder() .target( server ) .reason( ServerConnectEvent.Reason.COMMAND ) - .callback( new SendCallback.Entry( callback, target ) ) + .callback( new SendCallback.Entry( callback, player, server ) ) .build(); - target.connect( request ); + player.connect( request ); } sender.sendMessage( ChatColor.DARK_GREEN + "Attempting to send " + targets.size() + " players to " + server.getName() );