mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 02:05:28 +00:00
fix: check for the player before handling the messages a player sends
Several messages used the player, the character or the user they named without checking that there is one. A match request and a trade request are now only handled for the player that sent them, a linked mission request and a build mode change only for the sending player, and the remaining handlers return when the player, character or user is missing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,12 @@ namespace GameMessages {
|
||||
void RequestLinkedMission::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
// A player asks for the missions offered to themselves
|
||||
if (!player || !player->IsPlayer() || player->GetSystemAddress() != sysAddr) {
|
||||
LOG("Player %llu of a linked mission request is not the player that sent it", playerID);
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity.GetComponent(eReplicaComponentType::MISSION_OFFER));
|
||||
|
||||
if (missionOfferComponent != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user