Skip to content

Commit 9f5ae7d

Browse files
Bishbash777Bishbash777
andauthored
Chat patch bool check (#184)
* Only patch if ranks are enabled * fix dumb Co-authored-by: Bishbash777 <Bishbash777@gmail.com>
1 parent a573ca1 commit 9f5ae7d

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Essentials/Patches/ChatMessagePatch.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ public static void Patch(PatchContext ctx) {
4444
}
4545

4646
private static bool OnChatMessageReceived_Server(ref ChatMsg msg) {
47-
var Account = PlayerAccountData.GetAccount(msg.Author);
48-
if (Account != null) {
49-
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
50-
if (Rank.DisplayPrefix) {
51-
msg.Author = 0;
52-
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
47+
if (EssentialsPlugin.Instance.Config.EnableRanks) {
48+
var Account = PlayerAccountData.GetAccount(msg.Author);
49+
if (Account != null) {
50+
var Rank = RanksAndPermissions.GetRankData(Account.Rank);
51+
if (Rank.DisplayPrefix) {
52+
msg.Author = 0;
53+
msg.CustomAuthorName = $"{Rank.Prefix}{Account.Player}";
54+
}
5355
}
56+
return true;
5457
}
5558
return true;
5659
}

0 commit comments

Comments
 (0)