mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -100,6 +100,11 @@ namespace PlayerNameMapHolder
|
||||
PlayerNameMap.erase(p->GetName());
|
||||
}
|
||||
|
||||
void RemoveByName(std::string const& name)
|
||||
{
|
||||
PlayerNameMap.erase(name);
|
||||
}
|
||||
|
||||
Player* Find(std::string const& name)
|
||||
{
|
||||
std::string charName(name);
|
||||
@@ -290,3 +295,9 @@ void ObjectAccessor::RemoveObject(Player* player)
|
||||
HashMapHolder<Player>::Remove(player);
|
||||
PlayerNameMapHolder::Remove(player);
|
||||
}
|
||||
|
||||
void ObjectAccessor::UpdatePlayerNameMapReference(std::string oldname, Player* player)
|
||||
{
|
||||
PlayerNameMapHolder::RemoveByName(oldname);
|
||||
PlayerNameMapHolder::Insert(player);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,8 @@ namespace ObjectAccessor
|
||||
|
||||
template<>
|
||||
void RemoveObject(Player* player);
|
||||
|
||||
void UpdatePlayerNameMapReference(std::string oldname, Player* player);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -381,6 +381,8 @@ public:
|
||||
{
|
||||
target->SetName(newName);
|
||||
|
||||
ObjectAccessor::UpdatePlayerNameMapReference(player->GetName(), target);
|
||||
|
||||
if (WorldSession* session = target->GetSession())
|
||||
session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user