summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2023-05-11 22:05:17 +0200
committerMattes D <github@xoft.cz>2023-05-16 23:50:37 +0200
commitc9522fb740200ccef6230cec452c48efb31e5394 (patch)
tree7e74d70699e13dd0a92444a1a0add7a3059ac7ca /src/Entities
parentTry a timeout for jobs. (diff)
downloadcuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.gz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.bz2
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.lz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.xz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.zst
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp14
-rw-r--r--src/Entities/Player.cpp8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index c46f9e644..b6204387b 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -2402,9 +2402,9 @@ void cEntity::BroadcastDeathMessage(TakeDamageInfo & a_TDI)
}
UNREACHABLE("Unsupported damage type");
}();
- AString DeathMessage = Printf("%s %s", Name.c_str(), DamageText.c_str());
+ auto DeathMessage = fmt::format(FMT_STRING("{} {}"), Name, DamageText);
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
- if (DeathMessage != AString(""))
+ if (!DeathMessage.empty())
{
GetWorld()->BroadcastChatDeath(DeathMessage);
}
@@ -2412,9 +2412,9 @@ void cEntity::BroadcastDeathMessage(TakeDamageInfo & a_TDI)
else if (a_TDI.Attacker->IsPlayer())
{
cPlayer * Killer = static_cast<cPlayer *>(a_TDI.Attacker);
- AString DeathMessage = Printf("%s was killed by %s", Name.c_str(), Killer->GetName().c_str());
+ auto DeathMessage = fmt::format(FMT_STRING("{0} was killed by {1}"), Name, Killer->GetName());
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
- if (DeathMessage != AString(""))
+ if (!DeathMessage.empty())
{
GetWorld()->BroadcastChatDeath(DeathMessage);
}
@@ -2426,16 +2426,16 @@ void cEntity::BroadcastDeathMessage(TakeDamageInfo & a_TDI)
AString DeathMessage;
if (Monster->HasCustomName())
{
- DeathMessage = Printf("%s was killed by %s", Name.c_str(), Monster->GetCustomName().c_str());
+ DeathMessage = fmt::format(FMT_STRING("{0} was killed by {1}"), Name, Monster->GetCustomName());
}
else
{
AString KillerName = NamespaceSerializer::PrettifyEntityName(AString(NamespaceSerializer::From(Monster->GetMobType())), Monster->IsTame());
- DeathMessage = Printf("%s was killed by a %s", Name.c_str(), KillerName.c_str());
+ DeathMessage = fmt::format(FMT_STRING("{0} was killed by a {1}"), Name, KillerName);
}
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
- if (DeathMessage != AString(""))
+ if (!DeathMessage.empty())
{
GetWorld()->BroadcastChatDeath(DeathMessage);
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 9f4fcb971..ba1059b7c 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1682,7 +1682,7 @@ AString cPlayer::GetSuffix(void) const
-AString cPlayer::GetPlayerListName(void) const
+AString cPlayer::GetPlayerListName() const
{
const AString & Color = GetColor();
@@ -1692,7 +1692,7 @@ AString cPlayer::GetPlayerListName(void) const
}
else if ((GetName().length() <= 14) && !Color.empty())
{
- return Printf("%s%s", Color.c_str(), GetName().c_str());
+ return fmt::format(FMT_STRING("{}{}"), Color, GetName());
}
else
{
@@ -3092,8 +3092,8 @@ void cPlayer::OnRemoveFromWorld(cWorld & a_World)
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
{
- cRoot::Get()->BroadcastChatLeave(Printf("%s has left the game", GetName().c_str()));
- LOGINFO("Player %s has left the game", GetName().c_str());
+ cRoot::Get()->BroadcastChatLeave(fmt::format(FMT_STRING("{} has left the game"), GetName()));
+ LOGINFO("Player %s has left the game", GetName());
}
// Remove ourself from everyone's lists: