Skip to content

Commit

Permalink
Add check wether name is available or taken, if not dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
datejer committed Aug 24, 2020
1 parent a129a90 commit 2124d80
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions NameChecker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,23 @@ static void Main(string[] args)
}
catch
{
Console.ReadKey();
return;
string currentOwner = client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}")
.Result;

if (currentOwner == "")
{
Console.Title = $"{name} is available!";
Console.WriteLine("The name is available!");
Console.ReadKey();
return;
}
else
{
Console.Title = $"{name} is not available :(";
Console.WriteLine("The name is not available :(");
Console.ReadKey();
return;
}
}
}

Expand Down

0 comments on commit 2124d80

Please sign in to comment.