From cbf63a5ccc1e4bfd9d7474f3c24b27525aada4d5 Mon Sep 17 00:00:00 2001 From: Marcos <66353315+marcosvf132@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:17:04 -0300 Subject: [PATCH] Update mailbox.cpp --- src/items/containers/mailbox/mailbox.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/items/containers/mailbox/mailbox.cpp b/src/items/containers/mailbox/mailbox.cpp index 248c5c85367..af3b79eae13 100644 --- a/src/items/containers/mailbox/mailbox.cpp +++ b/src/items/containers/mailbox/mailbox.cpp @@ -80,6 +80,16 @@ bool Mailbox::sendItem(Item* item) const { return false; } + if (item && item->getContainer() && item->getTile()) { + SpectatorHashSet spectators; + g_game().map.getSpectators(spectators, item->getTile()->getPosition(), false, true); + for (Creature* spectator : spectators) { + if (spectator && spectator->getPlayer()) { + spectator->getPlayer()->autoCloseContainers(item->getContainer()); + } + } + } + Player* player = g_game().getPlayerByName(receiver, true); std::string writer; time_t date = time(0);