summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-11-11 22:02:29 +0100
committerGitHub <noreply@github.com>2021-11-11 22:02:29 +0100
commitd49ce751ba6f8f2eb171633cea30a1119935f8c7 (patch)
tree25cb23102c0d778cada555c0c25e6dc3247a6514 /src/WorldStorage
parentPrevent placing of hangables on illegal blocks and break when support block broken (#5301) (diff)
downloadcuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.gz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.bz2
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.lz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.xz
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.tar.zst
cuberite-d49ce751ba6f8f2eb171633cea30a1119935f8c7.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/StatisticsSerializer.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/WorldStorage/StatisticsSerializer.cpp b/src/WorldStorage/StatisticsSerializer.cpp
index df7aa9895..5143e174d 100644
--- a/src/WorldStorage/StatisticsSerializer.cpp
+++ b/src/WorldStorage/StatisticsSerializer.cpp
@@ -55,26 +55,15 @@ static void LoadCustomStatFromJSON(StatisticsManager & Manager, const Json::Valu
for (auto it = a_In.begin(); it != a_In.end(); ++it)
{
const auto & Key = it.key().asString();
- const auto StatInfo = NamespaceSerializer::SplitNamespacedID(Key);
- if (StatInfo.first == NamespaceSerializer::Namespace::Unknown)
+ const auto & [Namespace, Name] = NamespaceSerializer::SplitNamespacedID(Key);
+
+ if (Namespace == NamespaceSerializer::Namespace::Unknown)
{
// Ignore non-Vanilla, non-Cuberite namespaces for now:
continue;
}
- const auto & StatName = StatInfo.second;
- try
- {
- Manager.Custom[NamespaceSerializer::ToCustomStatistic(StatName)] = it->asUInt();
- }
- catch (const std::out_of_range &)
- {
- FLOGWARNING("Invalid statistic type \"{}\"", StatName);
- }
- catch (const Json::LogicError &)
- {
- FLOGWARNING("Invalid statistic value for type \"{}\"", StatName);
- }
+ Manager.Custom[NamespaceSerializer::ToCustomStatistic(Name)] = it->asUInt();
}
}