Makes native clan chat public for everyone

Rust nowadays has build-in clan support (still far from finished, but servers can enable it by setting clan.enabled "true" in server.cfg.
Sadly when using Better Chat, the clan chat becomes public for everyone on the server.

I suspect that the switch (chatchannel) also will require a Clan section.

BUMP πŸ‘‹

I have DM'ed you on discord @LaserHydra with a similar message.

Would love to use the new Clan system, but the messages turns up in public chat, and i also thing its a missing clan.channel in the switch (chatchannel) section.

Β 

Best

Luuxen

Β 

insert code at line 213:

Β 

case Chat.ChatChannel.Clan:
long clanid = basePlayer.clanId;

if (clanid == 0)
{
throw new InvalidOperationException("Chat channel is set to Clan, however the player is not part of a Clan.");
}

List<Network.Connection> clanlist = Facepunch.Pool.GetList<Network.Connection>();

IClan clan = null;
if (ClanManager.ServerInstance.Backend?.TryGet(clanid, out clan) ?? false)
{
foreach (ClanMember member in clan.Members)
{
var player = BasePlayer.FindByID(member.SteamId);
if (player!=null && player.IsConnected) clanlist.Add(player.net.connection);
}
}

if (clanlist.Count > 0)
{
ConsoleNetwork.SendClientCommand(clanlist, "chat.add", (int)chatchannel, chatMessage.Player.Id, output.Chat);
}
Facepunch.Pool.FreeList(ref clanlist);
break;

Β 

Β 

big thanksΒ  to @lorenzo for providing this fix <3

Amazing, thank you! I have asked in the uMod Discord if someone wants to merge it into the plugin officially. ❀️