Add whois command

This commit is contained in:
md_5 2013-05-24 14:35:27 +10:00
parent 9fdcded97f
commit 0e9002091b
2 changed files with 36 additions and 0 deletions

View File

@ -138,6 +138,7 @@ public class BungeeCord extends ProxyServer
getPluginManager().registerCommand( null, new CommandBungee() );
getPluginManager().registerCommand( null, new CommandPerms() );
getPluginManager().registerCommand( null, new CommandSend() );
getPluginManager().registerCommand( null, new CommandWhois() );
registerChannel( "BungeeCord" );
}

View File

@ -0,0 +1,35 @@
package net.md_5.bungee.command;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
public class CommandWhois extends Command
{
public CommandWhois()
{
super( "whois", "bungeecord.command.whois" );
}
@Override
public void execute(CommandSender sender, String[] args)
{
if ( args.length != 1 )
{
sender.sendMessage( ChatColor.RED + "Please follow this command by a user name" );
} else
{
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
if ( player == null || player.getServer() == null )
{
sender.sendMessage( ChatColor.RED + "That user is not online" );
} else
{
sender.sendMessage( ChatColor.BLUE + args[0] + " is online at" + player.getServer().getInfo().getName() );
}
}
}
}