Minecraft-Console-Client/MinecraftClient/Commands/List.cs
ORelio 9a98a9d46f Store extended player info, list display names
- Add 1.10.1 and 1.10.2 in supported version list
 - Store both player name and player display names
 - List command will sort players by player name
 - List command will now display by display name
 - Ability to use /list raw to display by real name

Suggestion by Johngreen123
2016-08-22 19:40:58 +02:00

26 lines
806 B
C#

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."; } }
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));
}
}
}