feat: adapt to gmlib 1.5.0
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Cleaner.h"
|
||||
#include <memory>
|
||||
|
||||
#include "gmlib/mc/world/Level.h"
|
||||
#include "gmlib/gm/data/TpsStatus.h"
|
||||
namespace Cleaner {
|
||||
|
||||
static std::shared_ptr<bool> mAutoCleanTask = std::make_shared<bool>(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})
|
||||
|
||||
@@ -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"); }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "Global.h"
|
||||
|
||||
#include "gmlib/mc/world/Level.h"
|
||||
namespace Helper {
|
||||
|
||||
void broadcastMessage(std::string_view msg) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
+1
-1
@@ -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 <regex>
|
||||
|
||||
+1
-1
@@ -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() {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user