fix: fix config read

This commit is contained in:
Tsubasa6848
2024-02-23 21:43:39 +08:00
Unverified
parent 7a19e82fb5
commit a161b23d55
2 changed files with 13 additions and 1 deletions
+2
View File
@@ -21,6 +21,8 @@ extern void reloadCleaner();
extern void loadCleaner();
extern void unloadCleaner();
extern bool isMatch(std::string& A, std::string& B);
} // namespace Cleaner
namespace VoteClean {
+10
View File
@@ -29,7 +29,17 @@ void ListenEvents() {
return;
}
}
if (Config->getValue<bool>({"ItemDespawn", "Enabled"}, true)) {
item.lifeTime() = ConfigFile::mItemDespawnTicks;
auto list = Config->getValue<std::vector<std::string>>({"ItemDespawn", "WhiteList"}, {});
auto type = item.item().getTypeName();
for (auto& key : list) {
if (isMatch(type, key)) {
return;
}
}
item.lifeTime() = ConfigFile::mItemDespawnTicks;
}
}
);
// MobTakeItemEvent