Skip to content
Permalink
Browse files

using /api [name] should be same as /api p [name]

  • Loading branch information...
UnknownShadow200 committed Jun 9, 2017
1 parent 162cb5c commit bb757556bf34d43e17bae617b38709fe8847adf2
Showing with 13 additions and 8 deletions.
  1. +13 −8 fCraft/Commands/InfoCommands.cs
@@ -1925,34 +1925,39 @@ static void EmotesHandler(Player player, CommandReader cmd)
CdApi.PrintUsage(player);
return;
}

string value = cmd.Next();
if (value == null) {
value = "player/" + player.Name;
}
if (value == null) { value = type; type = "player"; }
int id;

switch (type.ToLower()) {
case "id":
case "i":
if (!int.TryParse(value, out id)) {
player.Message("ID not valid integer!");
return;
} else {
value = "id/" + id;
}

value = "id/" + id;
break;

case "player":
case "p":
if (!Player.IsValidPlayerName(value)) {
player.Message("Name not a valid player name!");
return;
}

value = "player/" + value;
break;
default:
value = "player/" + player.Name;
break;
}

string data = Server.downloadDatastring("http://www.classicube.net/api/" + value);
if (string.IsNullOrEmpty(data) || !data.Contains("username")) {
player.Message("Player not found!");
return;
}

JsonObject result = JsonObject.Parse(data);
string error;
result.TryGetValue("error", out error);

0 comments on commit bb75755

Please sign in to comment.
You can’t perform that action at this time.