- Ban durations (TODO: add a way to set and view the durations through the menus).
- Separated ban & kick methods. - Fixed compilation errors in DebugConsole when building the server.
This commit is contained in:
@@ -99,15 +99,11 @@ namespace Barotrauma
|
||||
{
|
||||
SelectMessage(1);
|
||||
}
|
||||
|
||||
//textBox.Update(deltaTime);
|
||||
|
||||
if (PlayerInput.KeyDown(Keys.Enter) && textBox.Text != "")
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Enter))
|
||||
{
|
||||
ExecuteCommand(textBox.Text, game);
|
||||
textBox.Text = "";
|
||||
|
||||
//selectedIndex = messages.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,11 +1241,23 @@ namespace Barotrauma.Networking
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void KickPlayer(string kickedName, string reason, bool ban, bool range = false)
|
||||
public override void KickPlayer(string kickedName, string reason)
|
||||
{
|
||||
NetOutgoingMessage msg = client.CreateMessage();
|
||||
msg.Write((byte)ClientPacketHeader.SERVER_COMMAND);
|
||||
msg.Write((byte)(ban ? ClientPermissions.Ban : ClientPermissions.Kick));
|
||||
msg.Write((byte)ClientPermissions.Kick);
|
||||
//TODO: write the reason
|
||||
msg.Write(kickedName);
|
||||
|
||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||
}
|
||||
|
||||
public override void BanPlayer(string kickedName, string reason, bool range = false, TimeSpan? duration = null)
|
||||
{
|
||||
NetOutgoingMessage msg = client.CreateMessage();
|
||||
msg.Write((byte)ClientPacketHeader.SERVER_COMMAND);
|
||||
msg.Write((byte)ClientPermissions.Ban);
|
||||
//TODO: write the reason
|
||||
msg.Write(kickedName);
|
||||
|
||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||
|
||||
@@ -171,7 +171,15 @@ namespace Barotrauma.Networking
|
||||
|
||||
banReasonPrompt.Buttons[0].OnClicked += (btn, userData) =>
|
||||
{
|
||||
KickPlayer(clientName, textBox.Text, ban, rangeBan);
|
||||
if (ban)
|
||||
{
|
||||
//TODO: a way to set ban duration in the prompt
|
||||
BanPlayer(clientName, textBox.Text, ban, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickPlayer(clientName, textBox.Text);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
banReasonPrompt.Buttons[0].OnClicked += banReasonPrompt.Close;
|
||||
|
||||
Reference in New Issue
Block a user