- Ban duration can be set in the UI prompt.

- Ban reasons & durations are listed in the banlist menu.
- Clients tell the server the reason when kicking/banning another client.
- Added GUINumberInput GUIComponent.
- Ban duration saving/loading fixes.
This commit is contained in:
Joonas Rikkonen
2017-07-02 21:36:17 +03:00
parent df0bdb64d6
commit 8ae2fb225c
8 changed files with 193 additions and 27 deletions
@@ -754,21 +754,23 @@ namespace Barotrauma.Networking
switch (command)
{
case ClientPermissions.Kick:
string kickedName = inc.ReadString();
var kickedClient = connectedClients.Find(cl => cl != sender && cl.name == kickedName);
string kickedName = inc.ReadString().ToLowerInvariant();
string kickReason = inc.ReadString();
var kickedClient = connectedClients.Find(cl => cl != sender && cl.name.ToLowerInvariant() == kickedName);
if (kickedClient != null)
{
Log("Client \"" + sender.name + "\" kicked \"" + kickedClient.name + "\".", ServerLog.MessageType.ServerMessage);
KickClient(kickedClient, "Kicked by " + sender.name);
KickClient(kickedClient, string.IsNullOrEmpty(kickReason) ? "Kicked by " + sender.name : kickReason);
}
break;
case ClientPermissions.Ban:
string bannedName = inc.ReadString();
var bannedClient = connectedClients.Find(cl => cl != sender && cl.name == bannedName);
string bannedName = inc.ReadString().ToLowerInvariant();
string banReason = inc.ReadString();
var bannedClient = connectedClients.Find(cl => cl != sender && cl.name.ToLowerInvariant() == bannedName);
if (bannedClient != null)
{
Log("Client \"" + sender.name + "\" banned \"" + bannedClient.name + "\".", ServerLog.MessageType.ServerMessage);
BanClient(bannedClient, "Banned by " + sender.name, false);
BanClient(bannedClient, string.IsNullOrEmpty(banReason) ? "Banned by " + sender.name : banReason, false);
}
break;
case ClientPermissions.EndRound: