forked from SoDOff-Project/sodoff-mmo
rework `BanCommand
` to take in a user id of someone in the room instead of a full guid
edit comment at ``ApiUrl`` in appsettings.json
This commit is contained in:
parent
53db86f3c7
commit
1edbbde74c
@ -12,9 +12,13 @@ class BanCommand : IManagementCommand
|
||||
{
|
||||
if(arguments.Length < 2) { client.Send(Utils.BuildServerSideMessage($"Expected 3 Args, Got {arguments.Length + 1}", "Server")); return; }
|
||||
|
||||
if (arguments[0] == "help") client.Send(Utils.BuildServerSideMessage($"::ban - This bans a user who is in-room. First argument is the id of the user in-room. Room user lists start at 0.", "Server"));
|
||||
var clientToBan = client.Room!.Clients.ToArray()[int.Parse(arguments[0])].PlayerData.Uid;
|
||||
if (clientToBan == null) { client.Send(Utils.BuildServerSideMessage($"User Could Not Be Found", "Server")); return; }
|
||||
|
||||
// send an http request to the api set in appsettings
|
||||
ApiWebService apiWebService = new();
|
||||
var response = apiWebService.BanUser(client, arguments[0], arguments[1], arguments[2]);
|
||||
var response = apiWebService.BanUser(client, clientToBan, arguments[1], arguments[2]);
|
||||
var responseString = response.Content.ReadAsStringAsync().Result;
|
||||
|
||||
if (response.StatusCode != System.Net.HttpStatusCode.OK && responseString != null) { client.Send(Utils.BuildServerSideMessage(responseString, "Server")); return; }
|
||||
|
@ -63,7 +63,7 @@
|
||||
"// Authentication Required": "authentication is required to connect to mmo",
|
||||
"Authentication": "Required",
|
||||
|
||||
"// ApiUrl": "SoDOff API server URL for authentication calls",
|
||||
"// ApiUrl": "SoDOff API server URL for authentication calls and other calls",
|
||||
"ApiUrl": "http://localhost:5000",
|
||||
|
||||
"// BypassToken": "Token allowed to connect without authentication",
|
||||
|
Loading…
x
Reference in New Issue
Block a user