Whitelist shell feedback (#10694)

Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2022-08-19 16:42:47 +10:00
committed by GitHub
parent 86d7a1fbb9
commit 9ec4b0867e
2 changed files with 20 additions and 0 deletions

View File

@@ -31,10 +31,17 @@ public sealed class AddWhitelistCommand : IConsoleCommand
var guid = data.UserId;
var isWhitelisted = await db.GetWhitelistStatusAsync(guid);
if (isWhitelisted)
{
shell.WriteLine(Loc.GetString("command-whitelistadd-existing", ("username", data.Username)));
return;
}
await db.AddToWhitelistAsync(guid);
shell.WriteLine(Loc.GetString("command-whitelistadd-added", ("username", data.Username)));
return;
}
shell.WriteError(Loc.GetString("command-whitelistadd-not-found", ("username", args[0])));
}
}
@@ -60,10 +67,17 @@ public sealed class RemoveWhitelistCommand : IConsoleCommand
var guid = data.UserId;
var isWhitelisted = await db.GetWhitelistStatusAsync(guid);
if (!isWhitelisted)
{
shell.WriteLine(Loc.GetString("command-whitelistremove-existing", ("username", data.Username)));
return;
}
await db.RemoveFromWhitelistAsync(guid);
shell.WriteLine(Loc.GetString("command-whitelistremove-removed", ("username", data.Username)));
return;
}
shell.WriteError(Loc.GetString("command-whitelistremove-not-found", ("username", args[0])));
}
}

View File

@@ -3,9 +3,15 @@ whitelist-not-whitelisted-rp = You are not whitelisted. To become whitelisted, v
command-whitelistadd-description = Adds the player with the given username to the server whitelist.
command-whitelistadd-help = whitelistadd <username>
command-whitelistadd-existing = {$username} is already on the whitelist!
command-whitelistadd-added = {$username} added to the whitelist
command-whitelistadd-not-found = Unable to find '{$username}'
command-whitelistremove-description = Removes the player with the given username from the server whitelist.
command-whitelistremove-help = whitelistremove <username>
command-whitelistremove-existing = {$username} is not on the whitelist!
command-whitelistremove-removed = {$username} removed from the whitelist
command-whitelistremove-not-found = Unable to find '{$username}'
command-kicknonwhitelisted-description = Kicks all non-whitelisted players from the server.
command-kicknonwhitelisted-help = kicknonwhitelisted