summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
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/Protocol/ProtocolRecognizer.cpp
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 '')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index ffe839dac..8bfc18330 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -73,7 +73,7 @@ AString cMultiVersionProtocol::GetVersionTextFromInt(cProtocol::Version a_Protoc
}
ASSERT(!"Unknown protocol version");
- return Printf("Unknown protocol (%d)", a_ProtocolVersion);
+ return fmt::format(FMT_STRING("Unknown protocol ({})"), a_ProtocolVersion);
}
@@ -229,7 +229,7 @@ void cMultiVersionProtocol::SendDisconnect(cClientHandle & a_Client, const AStri
return;
}
- const AString Message = Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str());
+ const AString Message = fmt::format(FMT_STRING("{{\"text\":\"{}\"}}"), EscapeString(a_Reason));
const auto PacketID = GetPacketID(cProtocol::ePacketType::pktDisconnectDuringLogin);
cByteBuffer Out(
cByteBuffer::GetVarIntSize(PacketID) +
@@ -348,13 +348,14 @@ std::unique_ptr<cProtocol> cMultiVersionProtocol::TryRecognizeLengthedProtocol(c
default:
{
LOGD("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
- a_Client.GetIPString().c_str(), ProtocolVersion, ProtocolVersion
+ a_Client.GetIPString(), ProtocolVersion, ProtocolVersion
);
if (NextState != cProtocol::State::Status)
{
throw TriedToJoinWithUnsupportedProtocolException(
- Printf("Unsupported protocol version %u.\nTry connecting with Minecraft " MCS_CLIENT_VERSIONS, ProtocolVersion)
+ fmt::format(FMT_STRING("Unsupported protocol version {}.\nTry connecting with Minecraft {}"),
+ ProtocolVersion, MCS_CLIENT_VERSIONS)
);
}
@@ -441,7 +442,7 @@ void cMultiVersionProtocol::HandlePacketStatusRequest(cClientHandle & a_Client)
ResponseValue["description"] = Description;
if (!Favicon.empty())
{
- ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
+ ResponseValue["favicon"] = "data:image/png;base64," + Favicon;
}
AString Response = JsonUtils::WriteFastString(ResponseValue);