From a6fa1b511304550851232cbed678ddb871afeb76 Mon Sep 17 00:00:00 2001 From: Yangyangzhong82 Date: Sun, 19 Oct 2025 21:35:19 +0800 Subject: [PATCH 1/2] feat: adapt to gmlib 1.5.0 --- manifest.json | 2 +- src/Features/Clean.cpp | 2 +- src/Features/CleanTask.cpp | 7 ++++--- src/Features/Events.cpp | 3 ++- src/Features/Helper.cpp | 2 +- src/Features/VoteClean.cpp | 4 ++-- src/Global.h | 2 +- src/Mod.cpp | 2 +- src/RegisterCommand.cpp | 5 +++-- tooth.json | 6 +++--- xmake.lua | 6 +++--- 11 files changed, 22 insertions(+), 19 deletions(-) diff --git a/manifest.json b/manifest.json index 76a4fb5..260f350 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "${modName}", "entry": "${modFile}", "type": "native", - "version": "0.13.8", + "version": "0.13.9", "author": "GroupMountain", "description": "Clean Entities", "dependencies": [ diff --git a/src/Features/Clean.cpp b/src/Features/Clean.cpp index f5a31d0..f90f014 100644 --- a/src/Features/Clean.cpp +++ b/src/Features/Clean.cpp @@ -1,6 +1,6 @@ #include "Cleaner.h" #include "mc/world/actor/provider/SynchedActorDataAccess.h" - +#include "gmlib/mc/world/actor/Actor.h" namespace Cleaner { bool isMatch(std::string& A, std::string& B) { diff --git a/src/Features/CleanTask.cpp b/src/Features/CleanTask.cpp index b19e8a8..bf7a2ee 100644 --- a/src/Features/CleanTask.cpp +++ b/src/Features/CleanTask.cpp @@ -1,6 +1,7 @@ #include "Cleaner.h" #include - +#include "gmlib/mc/world/Level.h" +#include "gmlib/gm/data/TpsStatus.h" namespace Cleaner { static std::shared_ptr mAutoCleanTask = std::make_shared(false); @@ -109,9 +110,9 @@ void CleanTaskTPS(float min_tps) { co_await 10s; if (*mCleanTaskTPS == false) co_return; if (auto_clean_triggerred == false) { - if (gmlib::GMLevel::getInstance()->getServerAverageTps() <= min_tps) { + if (gmlib::TpsStatus::getInstance().getLevelAverageTps() <= min_tps) { auto_clean_triggerred = true; - auto mspt = S(gmlib::GMLevel::getInstance()->getServerAverageTps()); + auto mspt = S(gmlib::TpsStatus::getInstance().getLevelAverageTps()); if (config.Basic.ConsoleLog) { ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->warn( tr("cleaner.output.triggerAutoCleanTps", {mspt}) diff --git a/src/Features/Events.cpp b/src/Features/Events.cpp index fa9feb9..2849b92 100644 --- a/src/Features/Events.cpp +++ b/src/Features/Events.cpp @@ -1,5 +1,6 @@ #include "Cleaner.h" - +#include "gmlib/mc/world/Level.h" +#include "gmlib/mc/world/actor/Player.h" namespace Cleaner { void setShouldIgnore(gmlib::GMActor* ac) { ac->addTag("cleaner:ignore"); } diff --git a/src/Features/Helper.cpp b/src/Features/Helper.cpp index f9719f0..5703ea8 100644 --- a/src/Features/Helper.cpp +++ b/src/Features/Helper.cpp @@ -1,5 +1,5 @@ #include "Global.h" - +#include "gmlib/mc/world/Level.h" namespace Helper { void broadcastMessage(std::string_view msg) { diff --git a/src/Features/VoteClean.cpp b/src/Features/VoteClean.cpp index 3447a16..4117ed8 100644 --- a/src/Features/VoteClean.cpp +++ b/src/Features/VoteClean.cpp @@ -94,12 +94,12 @@ void voteClean(Player* pl) { } sendVoteForm(pl); ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> { - co_await std::chrono::seconds::duration(config.VoteClean.Cooldown); + co_await std::chrono::seconds(config.VoteClean.Cooldown); canVote = true; co_return; }).launch(ll::thread::ServerThreadExecutor::getDefault()); ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> { - co_await std::chrono::seconds::duration(config.VoteClean.CheckDelay); + co_await std::chrono::seconds(config.VoteClean.CheckDelay); checkVote(); co_return; }).launch(ll::thread::ServerThreadExecutor::getDefault()); diff --git a/src/Global.h b/src/Global.h index 7ec39a7..0f330f0 100644 --- a/src/Global.h +++ b/src/Global.h @@ -1,7 +1,7 @@ #pragma once // IWYU pragma: begin_exports #include "Mod.h" -#include "gmlib/include_lib.h" + #include "gmlib/include_ll.h" #include "ila/include_all.h" #include diff --git a/src/Mod.cpp b/src/Mod.cpp index 25e9e24..f9678b8 100644 --- a/src/Mod.cpp +++ b/src/Mod.cpp @@ -3,7 +3,7 @@ #include "Global.h" #include "Language.h" #include "ll/api/utils/ErrorUtils.h" - +#include "gmlib/mc/locale/I18nAPI.h" namespace Cleaner { Entry& Entry::getInstance() { diff --git a/src/RegisterCommand.cpp b/src/RegisterCommand.cpp index 5586c15..dd3162a 100644 --- a/src/RegisterCommand.cpp +++ b/src/RegisterCommand.cpp @@ -1,5 +1,6 @@ #include "Features/Cleaner.h" - +#include "gmlib/mc/world/Level.h" +#include "gmlib/gm/data/TpsStatus.h" struct CleanerParam { enum class Despawn { despawn } despawn; enum class Action { tps, clean, reload, mspt } action; @@ -47,7 +48,7 @@ void RegCleanerCommand() { return output.success( tr("cleaner.command.tps.output", {S(gmlib::GMLevel::getInstance()->getServerCurrentTps()), - S(gmlib::GMLevel::getInstance()->getServerAverageTps())}) + S(gmlib::TpsStatus::getInstance().getLevelAverageTps())}) ); } case CleanerParam::Action::mspt: { diff --git a/tooth.json b/tooth.json index b96ba10..9bd7955 100644 --- a/tooth.json +++ b/tooth.json @@ -2,7 +2,7 @@ "format_version": 3, "format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d", "tooth": "github.com/GroupMountain/Cleaner", - "version": "0.13.8", + "version": "0.13.9", "info": { "name": "Cleaner", "description": "A Powerful Entities Cleaning up Mod for BDS", @@ -18,8 +18,8 @@ "label": "", "platform": "win-x64", "dependencies": { - "github.com/GroupMountain/GMLIB-Release": ">=1.4.0", - "github.com/MiracleForest/iListenAttentively-Release": ">=0.7.0" + "github.com/GroupMountain/GMLIB-Release": ">=1.5.0", + "github.com/MiracleForest/iListenAttentively-Release": ">=0.8.0" }, "assets": [ { diff --git a/xmake.lua b/xmake.lua index a10c954..e0b0d22 100644 --- a/xmake.lua +++ b/xmake.lua @@ -9,10 +9,10 @@ if not has_config("vs_runtime") then end -- Option 1: Use the latest version of LeviLamina released on GitHub. -add_requires("levilamina 1.4.1") +add_requires("levilamina 1.5.2") add_requires("levibuildscript") -add_requires("gmlib 1.4.0") -add_requires("ilistenattentively 0.7.0") +add_requires("gmlib 1.5.2") +add_requires("ilistenattentively 0.8.0") target("Cleaner") -- Change this to your mod name. add_cxflags( From 03f7fcffa3b071d97554116ab06ee751774d6dd8 Mon Sep 17 00:00:00 2001 From: Yangyangzhong82 Date: Sun, 19 Oct 2025 21:46:15 +0800 Subject: [PATCH 2/2] chore: Update version number --- manifest.json | 2 +- tooth.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 260f350..ff2ed02 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "${modName}", "entry": "${modFile}", "type": "native", - "version": "0.13.9", + "version": "0.14.0", "author": "GroupMountain", "description": "Clean Entities", "dependencies": [ diff --git a/tooth.json b/tooth.json index 9bd7955..0adfce5 100644 --- a/tooth.json +++ b/tooth.json @@ -2,7 +2,7 @@ "format_version": 3, "format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d", "tooth": "github.com/GroupMountain/Cleaner", - "version": "0.13.9", + "version": "0.14.0", "info": { "name": "Cleaner", "description": "A Powerful Entities Cleaning up Mod for BDS",