Role ban UI updates (#16736)
This commit is contained in:
36
Content.Shared/Players/MsgRoleBans.cs
Normal file
36
Content.Shared/Players/MsgRoleBans.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Players;
|
||||
|
||||
/// <summary>
|
||||
/// Sent server -> client to inform the client of their role bans.
|
||||
/// </summary>
|
||||
public sealed class MsgRoleBans : NetMessage
|
||||
{
|
||||
public override MsgGroups MsgGroup => MsgGroups.EntityEvent;
|
||||
|
||||
public List<string> Bans = new();
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
|
||||
{
|
||||
var count = buffer.ReadVariableInt32();
|
||||
Bans.EnsureCapacity(count);
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
Bans.Add(buffer.ReadString());
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
|
||||
{
|
||||
buffer.WriteVariableInt32(Bans.Count);
|
||||
|
||||
foreach (var ban in Bans)
|
||||
{
|
||||
buffer.Write(ban);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user