Minecraft-Console-Client/MinecraftClient/Commands/List.cs

27 lines
806 B
C#
Raw Normal View History

2014-11-11 00:32:32 +11:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Commands
{
public class List : Command
{
public override string CMDName { get { return "list"; } }
public override string CMDDesc { get { return "list [raw]: get the player list."; } }
2014-11-11 00:32:32 +11:00
public override string Run(McTcpClient handler, string command)
{
bool rawNames = getArg(command).ToLower() == "raw";
return "PlayerList: "
+ String.Join(", ",
handler.GetOnlinePlayers()
.OrderBy(player => player.Name)
.Select(player => rawNames
? player.Name
: player.DisplayName));
}
}
2014-11-11 00:32:32 +11:00
}