Skip to content

Commit

Permalink
Chat patch bool check (#184)
Browse files Browse the repository at this point in the history
* Only patch if ranks are enabled

* fix dumb

Co-authored-by: Bishbash777 <[email protected]>
  • Loading branch information
Bishbash777 and Bishbash777 authored Mar 17, 2021
1 parent a573ca1 commit 9f5ae7d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Essentials/Patches/ChatMessagePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ public static void Patch(PatchContext ctx) {
}

private static bool OnChatMessageReceived_Server(ref ChatMsg msg) {
var Account = PlayerAccountData.GetAccount(msg.Author);
if (Account != null) {
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
if (Rank.DisplayPrefix) {
msg.Author = 0;
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
if (EssentialsPlugin.Instance.Config.EnableRanks) {
var Account = PlayerAccountData.GetAccount(msg.Author);
if (Account != null) {
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
if (Rank.DisplayPrefix) {
msg.Author = 0;
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
}
}
return true;
}
return true;
}
Expand Down

0 comments on commit 9f5ae7d

Please sign in to comment.