Skip to content

Commit

Permalink
Update v1.0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
papershredder432 authored May 3, 2022
1 parent be10960 commit e353ee8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
32 changes: 6 additions & 26 deletions src/CustomChatColors/CustomChatColors.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Linq;
using Rocket.Core.Plugins;
using Rocket.Unturned.Player;
using SDG.Unturned;
Expand Down Expand Up @@ -27,7 +26,6 @@ private void OnChatted(SteamPlayer player, EChatMode mode, ref Color chatted, re
return;

var playerId = player.playerID.steamID;
var uPlayer = UnturnedPlayer.FromCSteamID(playerId);
if (Configuration.Instance.CustomColors.FirstOrDefault(x => x.PlayerId == playerId.m_SteamID) == null)
return;

Expand All @@ -40,31 +38,13 @@ private void OnChatted(SteamPlayer player, EChatMode mode, ref Color chatted, re

var selectedEntry = Configuration.Instance.CustomColors.FirstOrDefault(x => x.PlayerId == playerId.m_SteamID);

isvisible = false;

switch (mode)
if (!ColorUtility.TryParseHtmlString($"#{selectedEntry.HexColorCode}", out Color ourColor))
{
case EChatMode.GROUP:
ChatManager.serverSendMessage($"[GROUP] <color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true);
break;

case EChatMode.LOCAL:
ChatManager.serverSendMessage($"[AREA] <color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true);
break;

case EChatMode.GLOBAL:
ChatManager.serverSendMessage($"<color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true);
break;

case EChatMode.WELCOME:
break;
case EChatMode.SAY:
break;

default:
Rocket.Core.Logging.Logger.Log("How'd ya get here?");
break;
Rocket.Core.Logging.Logger.LogWarning($"{selectedEntry.PlayerId} has an invalid color code! Please fix the entry in the config for their custom color to work!");
return;
}

chatted = ourColor;
}

protected override void Unload()
Expand Down
4 changes: 2 additions & 2 deletions src/CustomChatColors/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]

0 comments on commit e353ee8

Please sign in to comment.