#2820: Sending a player via /send prints incorrect message

This commit is contained in:
md_5 2020-04-22 11:49:33 +10:00
parent aa66633df8
commit b91d4d3003

View File

@ -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<ProxiedPlayer> 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() );