Merge pull request 'fix: null-session crash on event start/end broadcast' (#3) from fix/null-session-broadcast-crash into main

Reviewed-on: #3
This commit is contained in:
Jess Hallsworth 2026-09-04 07:51:01 -06:00
commit c2f400a60b

View file

@ -5,6 +5,7 @@
#include "DBCStores.h" #include "DBCStores.h"
#include "GameObject.h" #include "GameObject.h"
#include "Log.h" #include "Log.h"
#include "WorldSessionMgr.h"
#include "Map.h" #include "Map.h"
#include "MapMgr.h" #include "MapMgr.h"
#include "ObjectAccessor.h" #include "ObjectAccessor.h"
@ -324,7 +325,7 @@ public:
_currentSite.MapId, _currentSite.ZoneId, _currentSite.AreaId, anchor->GetName()); _currentSite.MapId, _currentSite.ZoneId, _currentSite.AreaId, anchor->GetName());
} }
ChatHandler(nullptr).SendWorldText(Acore::StringFormat(_config.StartMessage, FormatLocationForAnnouncement(_currentSite, anchor))); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormat(_config.StartMessage, FormatLocationForAnnouncement(_currentSite, anchor)));
if (_config.Debug) if (_config.Debug)
{ {
@ -877,7 +878,7 @@ private:
} }
std::string announcementLocation = FormatLocationForAnnouncement(_currentSite, anchor); std::string announcementLocation = FormatLocationForAnnouncement(_currentSite, anchor);
ChatHandler(nullptr).SendWorldText(Acore::StringFormat(_config.StartMessage, announcementLocation)); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormat(_config.StartMessage, announcementLocation));
if (_config.Debug) if (_config.Debug)
{ {
@ -898,7 +899,7 @@ private:
return; return;
std::string location = BuildLocationText(_currentSite); std::string location = BuildLocationText(_currentSite);
ChatHandler(nullptr).SendWorldText(Acore::StringFormat(_config.EndMessage, location)); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormat(_config.EndMessage, location));
if (_config.Debug) if (_config.Debug)
LOG_INFO(GoldRushLogFilter, "Gold Rush ended in {}{}.", location, forced ? " (forced)" : ""); LOG_INFO(GoldRushLogFilter, "Gold Rush ended in {}{}.", location, forced ? " (forced)" : "");