Compare commits
6 Commits
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "${modName}",
|
"name": "${modName}",
|
||||||
"entry": "${modFile}",
|
"entry": "${modFile}",
|
||||||
"type": "native",
|
"type": "native",
|
||||||
"version": "0.13.8",
|
"version": "0.14.0",
|
||||||
"author": "GroupMountain",
|
"author": "GroupMountain",
|
||||||
"description": "Clean Entities",
|
"description": "Clean Entities",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
#include "mc/world/actor/provider/SynchedActorDataAccess.h"
|
#include "mc/world/actor/provider/SynchedActorDataAccess.h"
|
||||||
|
#include "gmlib/mc/world/actor/Actor.h"
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
bool isMatch(std::string& A, std::string& B) {
|
bool isMatch(std::string& A, std::string& B) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "gmlib/mc/world/Level.h"
|
||||||
|
#include "gmlib/gm/data/TpsStatus.h"
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
static std::shared_ptr<bool> mAutoCleanTask = std::make_shared<bool>(false);
|
static std::shared_ptr<bool> mAutoCleanTask = std::make_shared<bool>(false);
|
||||||
@@ -109,9 +110,9 @@ void CleanTaskTPS(float min_tps) {
|
|||||||
co_await 10s;
|
co_await 10s;
|
||||||
if (*mCleanTaskTPS == false) co_return;
|
if (*mCleanTaskTPS == false) co_return;
|
||||||
if (auto_clean_triggerred == false) {
|
if (auto_clean_triggerred == false) {
|
||||||
if (gmlib::GMLevel::getInstance()->getServerAverageTps() <= min_tps) {
|
if (gmlib::TpsStatus::getInstance().getLevelAverageTps() <= min_tps) {
|
||||||
auto_clean_triggerred = true;
|
auto_clean_triggerred = true;
|
||||||
auto mspt = S(gmlib::GMLevel::getInstance()->getServerAverageTps());
|
auto mspt = S(gmlib::TpsStatus::getInstance().getLevelAverageTps());
|
||||||
if (config.Basic.ConsoleLog) {
|
if (config.Basic.ConsoleLog) {
|
||||||
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->warn(
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->warn(
|
||||||
tr("cleaner.output.triggerAutoCleanTps", {mspt})
|
tr("cleaner.output.triggerAutoCleanTps", {mspt})
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
|
#include "gmlib/mc/world/Level.h"
|
||||||
|
#include "gmlib/mc/world/actor/Player.h"
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
void setShouldIgnore(gmlib::GMActor* ac) { ac->addTag("cleaner:ignore"); }
|
void setShouldIgnore(gmlib::GMActor* ac) { ac->addTag("cleaner:ignore"); }
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ void ListenEvents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.ItemDespawn.Enabled) {
|
if (config.ItemDespawn.Enabled) {
|
||||||
item.lifeTime() = config.ItemDespawn.DespawnTime;
|
// item.lifeTime() = config.ItemDespawn.DespawnTime;
|
||||||
auto list = config.ItemDespawn.WhiteList;
|
auto list = config.ItemDespawn.WhiteList;
|
||||||
auto type = item.item().getTypeName();
|
auto type = item.item().getTypeName();
|
||||||
for (auto& key : list) {
|
for (auto& key : list) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
#include "gmlib/mc/world/Level.h"
|
||||||
namespace Helper {
|
namespace Helper {
|
||||||
|
|
||||||
void broadcastMessage(std::string_view msg) {
|
void broadcastMessage(std::string_view msg) {
|
||||||
|
|||||||
@@ -94,12 +94,12 @@ void voteClean(Player* pl) {
|
|||||||
}
|
}
|
||||||
sendVoteForm(pl);
|
sendVoteForm(pl);
|
||||||
ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> {
|
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;
|
canVote = true;
|
||||||
co_return;
|
co_return;
|
||||||
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> {
|
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();
|
checkVote();
|
||||||
co_return;
|
co_return;
|
||||||
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
// IWYU pragma: begin_exports
|
// IWYU pragma: begin_exports
|
||||||
#include "Mod.h"
|
#include "Mod.h"
|
||||||
#include "gmlib/include_lib.h"
|
|
||||||
#include "gmlib/include_ll.h"
|
#include "gmlib/include_ll.h"
|
||||||
#include "ila/include_all.h"
|
#include "ila/include_all.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "ll/api/utils/ErrorUtils.h"
|
#include "ll/api/utils/ErrorUtils.h"
|
||||||
|
#include "gmlib/mc/locale/I18nAPI.h"
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
Entry& Entry::getInstance() {
|
Entry& Entry::getInstance() {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Features/Cleaner.h"
|
#include "Features/Cleaner.h"
|
||||||
|
#include "gmlib/mc/world/Level.h"
|
||||||
|
#include "gmlib/gm/data/TpsStatus.h"
|
||||||
struct CleanerParam {
|
struct CleanerParam {
|
||||||
enum class Despawn { despawn } despawn;
|
enum class Despawn { despawn } despawn;
|
||||||
enum class Action { tps, clean, reload, mspt } action;
|
enum class Action { tps, clean, reload, mspt } action;
|
||||||
@@ -47,7 +48,7 @@ void RegCleanerCommand() {
|
|||||||
return output.success(
|
return output.success(
|
||||||
tr("cleaner.command.tps.output",
|
tr("cleaner.command.tps.output",
|
||||||
{S(gmlib::GMLevel::getInstance()->getServerCurrentTps()),
|
{S(gmlib::GMLevel::getInstance()->getServerCurrentTps()),
|
||||||
S(gmlib::GMLevel::getInstance()->getServerAverageTps())})
|
S(gmlib::TpsStatus::getInstance().getLevelAverageTps())})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case CleanerParam::Action::mspt: {
|
case CleanerParam::Action::mspt: {
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
"format_version": 3,
|
"format_version": 3,
|
||||||
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
||||||
"tooth": "github.com/GroupMountain/Cleaner",
|
"tooth": "github.com/GroupMountain/Cleaner",
|
||||||
"version": "0.13.8",
|
"version": "0.14.0",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "Cleaner",
|
"name": "Cleaner",
|
||||||
"description": "A Powerful Entities Cleaning up Mod for BDS",
|
"description": "A Powerful Entities Cleaning up Mod for BDS",
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
"label": "",
|
"label": "",
|
||||||
"platform": "win-x64",
|
"platform": "win-x64",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/GroupMountain/GMLIB": ">=1.4.0",
|
"github.com/GroupMountain/GMLIB-Release": ">=1.5.0",
|
||||||
"github.com/MiracleForest/iListenAttentively-Release": ">=0.7.0"
|
"github.com/MiracleForest/iListenAttentively-Release": ">=0.8.0"
|
||||||
},
|
},
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ if not has_config("vs_runtime") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Option 1: Use the latest version of LeviLamina released on GitHub.
|
-- 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("levibuildscript")
|
||||||
add_requires("gmlib 1.4.0")
|
add_requires("gmlib 1.5.2")
|
||||||
add_requires("ilistenattentively 0.7.0")
|
add_requires("ilistenattentively 0.8.0")
|
||||||
|
|
||||||
target("Cleaner") -- Change this to your mod name.
|
target("Cleaner") -- Change this to your mod name.
|
||||||
add_cxflags(
|
add_cxflags(
|
||||||
|
|||||||
Reference in New Issue
Block a user