2020#include " Guild.h"
2121#include " Log.h"
2222#include " PlayerScript.h"
23+ #include " World.h"
2324
2425class ChatLogScript : public PlayerScript
2526{
@@ -38,6 +39,9 @@ class ChatLogScript : public PlayerScript
3839
3940 bool OnPlayerCanUseChat (Player* player, uint32 type, uint32 lang, std::string& msg) override
4041 {
42+ if (!sWorld ->getBoolConfig (CONFIG_CHATLOG_ENABLED ))
43+ return true ;
44+
4145 std::string logType = " " ;
4246 std::string chatType = " " ;
4347
@@ -67,6 +71,9 @@ class ChatLogScript : public PlayerScript
6771
6872 bool OnPlayerCanUseChat (Player* player, uint32 /* type*/ , uint32 lang, std::string& msg, Player* receiver) override
6973 {
74+ if (!sWorld ->getBoolConfig (CONFIG_CHATLOG_ENABLED ))
75+ return true ;
76+
7077 // ! NOTE:
7178 // ! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
7279 std::string logType = (lang != LANG_ADDON ) ? " chat." : " chat.addon." ;
@@ -80,6 +87,9 @@ class ChatLogScript : public PlayerScript
8087
8188 bool OnPlayerCanUseChat (Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
8289 {
90+ if (!sWorld ->getBoolConfig (CONFIG_CHATLOG_ENABLED ))
91+ return true ;
92+
8393 // ! NOTE:
8494 // ! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
8595 std::string logType = (lang != LANG_ADDON ) ? " chat." : " chat.addon." ;
@@ -116,6 +126,9 @@ class ChatLogScript : public PlayerScript
116126
117127 bool OnPlayerCanUseChat (Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
118128 {
129+ if (!sWorld ->getBoolConfig (CONFIG_CHATLOG_ENABLED ))
130+ return true ;
131+
119132 // ! NOTE:
120133 // ! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
121134 std::string logType = (lang != LANG_ADDON ) ? " chat." : " chat.addon." ;
@@ -141,6 +154,9 @@ class ChatLogScript : public PlayerScript
141154
142155 bool OnPlayerCanUseChat (Player* player, uint32 /* type*/ , uint32 /* lang*/ , std::string& msg, Channel* channel) override
143156 {
157+ if (!sWorld ->getBoolConfig (CONFIG_CHATLOG_ENABLED ))
158+ return true ;
159+
144160 bool isSystem = channel &&
145161 (channel->HasFlag (CHANNEL_FLAG_TRADE ) ||
146162 channel->HasFlag (CHANNEL_FLAG_GENERAL ) ||
0 commit comments