Return if command should not be executed to avoid exceptions and unnecessary messages to the player.
This commit is contained in:
parent
332bdaaec0
commit
9d3bddedb6
@ -27,6 +27,7 @@ public class CommandSend extends Command
|
|||||||
if ( target == null )
|
if ( target == null )
|
||||||
{
|
{
|
||||||
sender.sendMessage( ChatColor.RED + "Target server does not exist" );
|
sender.sendMessage( ChatColor.RED + "Target server does not exist" );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( args[0].equalsIgnoreCase( "all" ) )
|
if ( args[0].equalsIgnoreCase( "all" ) )
|
||||||
@ -40,6 +41,7 @@ public class CommandSend extends Command
|
|||||||
if ( !( sender instanceof ProxiedPlayer ) )
|
if ( !( sender instanceof ProxiedPlayer ) )
|
||||||
{
|
{
|
||||||
sender.sendMessage( ChatColor.RED + "Only in game players can use this command" );
|
sender.sendMessage( ChatColor.RED + "Only in game players can use this command" );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
ProxiedPlayer player = (ProxiedPlayer) sender;
|
||||||
for ( ProxiedPlayer p : player.getServer().getInfo().getPlayers() )
|
for ( ProxiedPlayer p : player.getServer().getInfo().getPlayers() )
|
||||||
@ -52,6 +54,7 @@ public class CommandSend extends Command
|
|||||||
if ( player == null )
|
if ( player == null )
|
||||||
{
|
{
|
||||||
sender.sendMessage( ChatColor.RED + "That player is not online" );
|
sender.sendMessage( ChatColor.RED + "That player is not online" );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
summon( player, target, sender );
|
summon( player, target, sender );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user