0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-16 08:35:07 +00:00

add command: ban profile <profile-id>

To add a profile ID to the ban list.
This commit is contained in:
Robin C. Ladiges 2023-03-22 21:43:28 +01:00
parent 5dcb85eb68
commit 2f2c1fd4f7
No known key found for this signature in database
GPG key ID: B494D3DF92661B99

View file

@ -120,7 +120,7 @@ public static class BanLists {
public static string HandleBanCommand(string[] args, MUCH much) {
if (args.Length == 0) {
return "Usage: ban {player|ip} ...";
return "Usage: ban {player|profile|ip} ...";
}
string cmd = args[0];
@ -128,7 +128,7 @@ public static class BanLists {
switch (cmd) {
default:
return "Usage: ban {player|ip} ...";
return "Usage: ban {player|profile|ip} ...";
case "player":
if (args.Length == 0) {
@ -154,6 +154,21 @@ public static class BanLists {
Save();
return sb.ToString();
case "profile":
if (args.Length != 1) {
return "Usage: ban profile <profile-id>";
}
if (!Guid.TryParse(args[0], out Guid id)) {
return "Invalid profile ID value!";
}
if (IsProfileBanned(id)) {
return "Profile " + id.ToString() + " is already banned.";
}
BanProfile(id);
CrashMultiple(args, much);
Save();
return "Banned profile: " + id.ToString();
case "ip":
if (args.Length != 1) {
return "Usage: ban ip <ipv4-address>";