Compare commits
20 Commits
@@ -1,5 +1,23 @@
|
|||||||
Diagnostics:
|
Diagnostics:
|
||||||
Suppress: ["-Wmicrosoft-enum-forward-reference", "-Wc++11-narrowing", "-Wc++2b-extensions", "-Wmicrosoft-cast"]
|
Suppress:
|
||||||
|
- "-Wmicrosoft-enum-forward-reference"
|
||||||
|
- "-Wc++11-narrowing"
|
||||||
|
- "-Wc++2b-extensions"
|
||||||
|
- "-Wmicrosoft-cast"
|
||||||
|
- "-Wcxx20_deducing_this"
|
||||||
|
- "-Wundefined_internal_type"
|
||||||
|
- "-Wincomplete_member_access"
|
||||||
|
- "-Wsizeof_alignof_incomplete_or_sizeless_type"
|
||||||
|
- "-Wexplicit_spec_non_template"
|
||||||
|
- "-Wovl_no_viable_function_in_init"
|
||||||
CompileFlags:
|
CompileFlags:
|
||||||
Add: ["-ferror-limit=0", "-D__FUNCTION__=\"dummy\"", "-D_CRT_USE_BUILTIN_OFFSETOF", "-std=c++23"]
|
Add:
|
||||||
Remove: ["/Yu_HeaderOutputPredefine.h", "/FI_HeaderOutputPredefine.h"]
|
- "-Xclang"
|
||||||
|
- "-triple=x86_64-windows-msvc"
|
||||||
|
- "-ferror-limit=0"
|
||||||
|
- '-D__FUNCTION__="dummy"'
|
||||||
|
- "-Dnsel_CONFIG_SELECT_EXPECTED=nsel_EXPECTED_NONSTD"
|
||||||
|
- "-Xclang"
|
||||||
|
- "-std=c++23"
|
||||||
|
Remove:
|
||||||
|
- "-std"
|
||||||
@@ -16,7 +16,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: xmake-io/github-action-setup-xmake@v1
|
- uses: xmake-io/github-action-setup-xmake@v1
|
||||||
with:
|
with:
|
||||||
xmake-version: latest
|
xmake-version: 3.0.0
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake repo -u
|
xmake repo -u
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: xmake-io/github-action-setup-xmake@v1
|
- uses: xmake-io/github-action-setup-xmake@v1
|
||||||
with:
|
with:
|
||||||
xmake-version: latest
|
xmake-version: 3.0.0
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake repo -u
|
xmake repo -u
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
@@ -41,7 +42,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: release/
|
path: release/
|
||||||
|
|||||||
@@ -101,6 +101,13 @@
|
|||||||
"Cooldown": 120, // 投票冷却时间 单位:秒
|
"Cooldown": 120, // 投票冷却时间 单位:秒
|
||||||
"CheckDelay": 30, // 投票时长 单位:秒
|
"CheckDelay": 30, // 投票时长 单位:秒
|
||||||
"Percentage": 50 // 投票百分比(大于此值则清理)
|
"Percentage": 50 // 投票百分比(大于此值则清理)
|
||||||
|
},
|
||||||
|
"UnloadActorClean": { // 离线实体清理
|
||||||
|
"Enabled": false, // 是否启用
|
||||||
|
"CleanList": [ // 清理实体列表
|
||||||
|
"minecraft:iron_golem", // 铁傀儡
|
||||||
|
"minecraft:zombie_pigman" // 僵尸猪灵
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
+4
-1
@@ -2,12 +2,15 @@
|
|||||||
"name": "${modName}",
|
"name": "${modName}",
|
||||||
"entry": "${modFile}",
|
"entry": "${modFile}",
|
||||||
"type": "native",
|
"type": "native",
|
||||||
"version": "0.13.2",
|
"version": "0.13.7",
|
||||||
"author": "GroupMountain",
|
"author": "GroupMountain",
|
||||||
"description": "Clean Entities",
|
"description": "Clean Entities",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{
|
{
|
||||||
"name": "GMLIB"
|
"name": "GMLIB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "iListenAttentively"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-1
@@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <iostream>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Cleaner {
|
||||||
struct Config {
|
struct Config {
|
||||||
int version = 2;
|
int version = 2;
|
||||||
|
|
||||||
@@ -90,4 +91,10 @@ struct Config {
|
|||||||
int CheckDelay = 30;
|
int CheckDelay = 30;
|
||||||
int Percentage = 50;
|
int Percentage = 50;
|
||||||
} VoteClean;
|
} VoteClean;
|
||||||
|
|
||||||
|
struct Unload_Actor_Clean {
|
||||||
|
bool Enabled = false;
|
||||||
|
std::vector<std::string> CleanList = {"minecraft:iron_golem", "minecraft:zombie_pigman"};
|
||||||
|
} UnloadActorClean;
|
||||||
};
|
};
|
||||||
|
} // namespace Cleaner
|
||||||
+13
-8
@@ -1,4 +1,5 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
|
#include "mc/world/actor/provider/SynchedActorDataAccess.h"
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
@@ -15,9 +16,11 @@ bool isMatch(std::string& A, std::string& B) {
|
|||||||
return (A == B);
|
return (A == B);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldIgnore(GMLIB_Actor* ac) {
|
bool isTrust(Actor* ac) { return SynchedActorDataAccess::getActorFlag(ac->getEntityContext(), ::ActorFlags::Trusting); }
|
||||||
if (ac->isMob() || ac->isItemActor()) {
|
|
||||||
if (ac->isTame() || ac->isTrusting() || ac->getNameTag() != "" || ac->hasTag("cleaner:ignore")) {
|
bool shouldIgnore(gmlib::GMActor* ac) {
|
||||||
|
if (ac->hasCategory(::ActorCategory::Mob) || ac->hasCategory(::ActorCategory::Item)) {
|
||||||
|
if (ac->isTame() || isTrust(ac) || ac->getNameTag() != "" || ac->hasTag("cleaner:ignore")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +30,7 @@ bool shouldIgnore(GMLIB_Actor* ac) {
|
|||||||
bool ShouldClean(Actor* actor) {
|
bool ShouldClean(Actor* actor) {
|
||||||
// Players
|
// Players
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
auto en = (GMLIB_Actor*)actor;
|
auto en = (gmlib::GMActor*)actor;
|
||||||
if (en->isPlayer() || shouldIgnore(en)) {
|
if (en->isPlayer() || shouldIgnore(en)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -38,7 +41,7 @@ bool ShouldClean(Actor* actor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Items
|
// Items
|
||||||
if (en->isItemActor()) {
|
if (en->hasCategory(::ActorCategory::Item)) {
|
||||||
if (config.CleanItem.Enabled) {
|
if (config.CleanItem.Enabled) {
|
||||||
auto itac = (ItemActor*)en;
|
auto itac = (ItemActor*)en;
|
||||||
if (itac->age() <= config.CleanItem.ExistTicks) {
|
if (itac->age() <= config.CleanItem.ExistTicks) {
|
||||||
@@ -56,7 +59,7 @@ bool ShouldClean(Actor* actor) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Mobs
|
// Mobs
|
||||||
else if (en->isMob()) {
|
else if (en->hasCategory(::ActorCategory::Mob)) {
|
||||||
if (config.CleanMobs.Enabled) {
|
if (config.CleanMobs.Enabled) {
|
||||||
auto blacklist = config.CleanMobs.BlackList;
|
auto blacklist = config.CleanMobs.BlackList;
|
||||||
for (auto& key : blacklist) {
|
for (auto& key : blacklist) {
|
||||||
@@ -94,8 +97,9 @@ bool ShouldClean(Actor* actor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ExecuteClean() {
|
int ExecuteClean() {
|
||||||
|
auto level = ll::service::getLevel();
|
||||||
int clean_count = 0;
|
int clean_count = 0;
|
||||||
auto all_entities = GMLIB_Level::getLevel()->getRuntimeActorList();
|
auto all_entities = level->getRuntimeActorList();
|
||||||
for (auto entity : all_entities) {
|
for (auto entity : all_entities) {
|
||||||
if (ShouldClean(entity)) {
|
if (ShouldClean(entity)) {
|
||||||
entity->despawn();
|
entity->despawn();
|
||||||
@@ -106,8 +110,9 @@ int ExecuteClean() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CountEntities() {
|
int CountEntities() {
|
||||||
|
auto level = ll::service::getLevel();
|
||||||
int clean_count = 0;
|
int clean_count = 0;
|
||||||
auto all_entities = GMLIB_Level::getLevel()->getRuntimeActorList();
|
auto all_entities = level->getRuntimeActorList();
|
||||||
for (auto* entity : all_entities) {
|
for (auto* entity : all_entities) {
|
||||||
if (ShouldClean(entity)) {
|
if (ShouldClean(entity)) {
|
||||||
clean_count++;
|
clean_count++;
|
||||||
|
|||||||
+85
-55
@@ -1,21 +1,24 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
static std::shared_ptr<ll::schedule::task::Task<ll::chrono::ServerClock>> mAutoCleanTask = nullptr;
|
static std::shared_ptr<bool> mAutoCleanTask = std::make_shared<bool>(false);
|
||||||
static std::shared_ptr<ll::schedule::task::Task<ll::chrono::ServerClock>> mCleanTaskCount = nullptr;
|
static std::shared_ptr<bool> mCleanTaskCount = std::make_shared<bool>(false);
|
||||||
static std::shared_ptr<ll::schedule::task::Task<ll::chrono::ServerClock>> mCleanTaskTPS = nullptr;
|
static std::shared_ptr<bool> mCleanTaskTPS = std::make_shared<bool>(false);
|
||||||
|
|
||||||
bool auto_clean_triggerred = false;
|
bool auto_clean_triggerred = false;
|
||||||
|
|
||||||
void CleanTask() {
|
void CleanTask() {
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
auto time = config.Basic.Notice1;
|
auto time = config.Basic.Notice1;
|
||||||
auto announce_time = config.Basic.Notice2;
|
auto announce_time = config.Basic.Notice2;
|
||||||
auto time_1 = std::chrono::seconds::duration(time);
|
std::chrono::seconds time_1(time);
|
||||||
auto time_2 = std::chrono::seconds::duration(time - announce_time);
|
std::chrono::seconds time_2(time - announce_time);
|
||||||
if (config.Basic.ConsoleLog) {
|
if (config.Basic.ConsoleLog) {
|
||||||
logger.info(tr("cleaner.output.count1", {S(time_1.count())}));
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->info(
|
||||||
|
tr("cleaner.output.count1", {S(time_1.count())})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (config.Basic.SendBroadcast) {
|
if (config.Basic.SendBroadcast) {
|
||||||
Helper::broadcastMessage(tr("cleaner.output.count1", {S(time_1.count())}));
|
Helper::broadcastMessage(tr("cleaner.output.count1", {S(time_1.count())}));
|
||||||
@@ -23,9 +26,12 @@ void CleanTask() {
|
|||||||
if (config.Basic.SendToast) {
|
if (config.Basic.SendToast) {
|
||||||
Helper::broadcastToast(tr("cleaner.output.count2", {S(announce_time)}));
|
Helper::broadcastToast(tr("cleaner.output.count2", {S(announce_time)}));
|
||||||
}
|
}
|
||||||
Cleaner::Entry::getInstance().getScheduler().add<DelayTask>(time_2, [announce_time, &config] {
|
ll::coro::keepThis([announce_time, &config, time_2]() -> ll::coro::CoroTask<> {
|
||||||
|
co_await time_2;
|
||||||
if (config.Basic.ConsoleLog) {
|
if (config.Basic.ConsoleLog) {
|
||||||
logger.info(tr("cleaner.output.count2", {S(announce_time)}));
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->info(
|
||||||
|
tr("cleaner.output.count2", {S(announce_time)})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (config.Basic.SendBroadcast) {
|
if (config.Basic.SendBroadcast) {
|
||||||
Helper::broadcastMessage(tr("cleaner.output.count2", {S(announce_time)}));
|
Helper::broadcastMessage(tr("cleaner.output.count2", {S(announce_time)}));
|
||||||
@@ -33,11 +39,13 @@ void CleanTask() {
|
|||||||
if (config.Basic.SendToast) {
|
if (config.Basic.SendToast) {
|
||||||
Helper::broadcastToast(tr("cleaner.output.count2", {S(announce_time)}));
|
Helper::broadcastToast(tr("cleaner.output.count2", {S(announce_time)}));
|
||||||
}
|
}
|
||||||
});
|
co_return;
|
||||||
Cleaner::Entry::getInstance().getScheduler().add<DelayTask>(time_1, [&config] {
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
|
ll::coro::keepThis([announce_time, &config, time_1]() -> ll::coro::CoroTask<> {
|
||||||
|
co_await time_1;
|
||||||
auto count = ExecuteClean();
|
auto count = ExecuteClean();
|
||||||
if (config.Basic.ConsoleLog) {
|
if (config.Basic.ConsoleLog) {
|
||||||
logger.info(tr("cleaner.output.finish", {S(count)}));
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->info(tr("cleaner.output.finish", {S(count)}));
|
||||||
}
|
}
|
||||||
if (config.Basic.SendBroadcast) {
|
if (config.Basic.SendBroadcast) {
|
||||||
Helper::broadcastMessage(tr("cleaner.output.finish", {S(count)}));
|
Helper::broadcastMessage(tr("cleaner.output.finish", {S(count)}));
|
||||||
@@ -46,70 +54,92 @@ void CleanTask() {
|
|||||||
Helper::broadcastToast(tr("cleaner.output.finish", {S(count)}));
|
Helper::broadcastToast(tr("cleaner.output.finish", {S(count)}));
|
||||||
}
|
}
|
||||||
auto_clean_triggerred = false;
|
auto_clean_triggerred = false;
|
||||||
});
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoCleanTask(int seconds) {
|
void AutoCleanTask(int seconds) {
|
||||||
auto time = std::chrono::seconds::duration(seconds);
|
std::chrono::seconds time(seconds);
|
||||||
mAutoCleanTask = Cleaner::Entry::getInstance().getScheduler().add<RepeatTask>(time, [] { CleanTask(); });
|
*mAutoCleanTask = true;
|
||||||
|
ll::coro::keepThis([time]() -> ll::coro::CoroTask<> {
|
||||||
|
while (true) {
|
||||||
|
co_await time;
|
||||||
|
if (*mAutoCleanTask == false) co_return;
|
||||||
|
CleanTask();
|
||||||
|
}
|
||||||
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanTaskCount(int max_entities) {
|
void CleanTaskCount(int max_entities) {
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
mCleanTaskCount = Cleaner::Entry::getInstance().getScheduler().add<RepeatTask>(10s, [max_entities, &config] {
|
*mCleanTaskCount = true;
|
||||||
auto count = CountEntities();
|
ll::coro::keepThis([max_entities, &config]() -> ll::coro::CoroTask<> {
|
||||||
if (auto_clean_triggerred == false) {
|
while (true) {
|
||||||
if (count >= max_entities) {
|
co_await 10s;
|
||||||
auto_clean_triggerred = true;
|
if (*mCleanTaskCount == false) co_return;
|
||||||
if (config.Basic.ConsoleLog) {
|
auto count = CountEntities();
|
||||||
logger.warn(tr("cleaner.output.triggerAutoCleanCount", {S(count)}));
|
if (auto_clean_triggerred == false) {
|
||||||
|
if (count >= max_entities) {
|
||||||
|
auto_clean_triggerred = true;
|
||||||
|
if (config.Basic.ConsoleLog) {
|
||||||
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->warn(
|
||||||
|
tr("cleaner.output.triggerAutoCleanCount", {S(count)})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (config.Basic.SendBroadcast) {
|
||||||
|
Helper::broadcastMessage(tr("cleaner.output.triggerAutoCleanCount", {S(count)}));
|
||||||
|
}
|
||||||
|
if (config.Basic.SendToast) {
|
||||||
|
Helper::broadcastToast(tr("cleaner.output.triggerAutoCleanCount", {S(count)}));
|
||||||
|
}
|
||||||
|
CleanTask();
|
||||||
}
|
}
|
||||||
if (config.Basic.SendBroadcast) {
|
|
||||||
Helper::broadcastMessage(tr("cleaner.output.triggerAutoCleanCount", {S(count)}));
|
|
||||||
}
|
|
||||||
if (config.Basic.SendToast) {
|
|
||||||
Helper::broadcastToast(tr("cleaner.output.triggerAutoCleanCount", {S(count)}));
|
|
||||||
}
|
|
||||||
CleanTask();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanTaskTPS(float min_tps) {
|
void CleanTaskTPS(float min_tps) {
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
mCleanTaskTPS = Cleaner::Entry::getInstance().getScheduler().add<RepeatTask>(10s, [min_tps, &config] {
|
*mCleanTaskTPS = true;
|
||||||
if (auto_clean_triggerred == false) {
|
ll::coro::keepThis([min_tps, &config]() -> ll::coro::CoroTask<> {
|
||||||
if (GMLIB_Level::getLevel()->getServerAverageTps() <= min_tps) {
|
while (true) {
|
||||||
auto_clean_triggerred = true;
|
co_await 10s;
|
||||||
auto mspt = S(GMLIB_Level::getLevel()->getServerAverageTps());
|
if (*mCleanTaskTPS == false) co_return;
|
||||||
if (config.Basic.ConsoleLog) {
|
if (auto_clean_triggerred == false) {
|
||||||
logger.warn(tr("cleaner.output.triggerAutoCleanTps", {mspt}));
|
if (gmlib::GMLevel::getInstance()->getServerAverageTps() <= min_tps) {
|
||||||
|
auto_clean_triggerred = true;
|
||||||
|
auto mspt = S(gmlib::GMLevel::getInstance()->getServerAverageTps());
|
||||||
|
if (config.Basic.ConsoleLog) {
|
||||||
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->warn(
|
||||||
|
tr("cleaner.output.triggerAutoCleanTps", {mspt})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (config.Basic.SendBroadcast) {
|
||||||
|
Helper::broadcastMessage(tr("cleaner.output.triggerAutoCleanTps", {mspt}));
|
||||||
|
}
|
||||||
|
if (config.Basic.SendToast) {
|
||||||
|
Helper::broadcastToast(tr("cleaner.output.triggerAutoCleanTps", {mspt}));
|
||||||
|
}
|
||||||
|
CleanTask();
|
||||||
}
|
}
|
||||||
if (config.Basic.SendBroadcast) {
|
|
||||||
Helper::broadcastMessage(tr("cleaner.output.triggerAutoCleanTps", {mspt}));
|
|
||||||
}
|
|
||||||
if (config.Basic.SendToast) {
|
|
||||||
Helper::broadcastToast(tr("cleaner.output.triggerAutoCleanTps", {mspt}));
|
|
||||||
}
|
|
||||||
CleanTask();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopAllTasks() {
|
void stopAllTasks() {
|
||||||
if (!mCleanTaskCount) {
|
if (!mCleanTaskCount) {
|
||||||
mCleanTaskTPS->cancel();
|
*mCleanTaskTPS = false;
|
||||||
Cleaner::Entry::getInstance().getScheduler().remove(mCleanTaskTPS);
|
|
||||||
}
|
}
|
||||||
if (mCleanTaskCount) {
|
if (mCleanTaskCount) {
|
||||||
mCleanTaskCount->cancel();
|
*mCleanTaskCount = false;
|
||||||
Cleaner::Entry::getInstance().getScheduler().remove(mCleanTaskCount);
|
|
||||||
}
|
}
|
||||||
if (mAutoCleanTask) {
|
if (mAutoCleanTask) {
|
||||||
mAutoCleanTask->cancel();
|
*mAutoCleanTask = false;
|
||||||
Cleaner::Entry::getInstance().getScheduler().remove(mAutoCleanTask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace Cleaner
|
} // namespace Cleaner
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ namespace Cleaner {
|
|||||||
|
|
||||||
void loadCleaner() {
|
void loadCleaner() {
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
|
if(config.UnloadActorClean.Enabled){
|
||||||
|
UnloadActorClean::cleanUnloadActor();
|
||||||
|
}
|
||||||
if (config.ScheduleClean.Enabled) {
|
if (config.ScheduleClean.Enabled) {
|
||||||
Cleaner::AutoCleanTask(config.ScheduleClean.CleanInterval);
|
Cleaner::AutoCleanTask(config.ScheduleClean.CleanInterval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
using namespace ll::schedule;
|
|
||||||
using namespace ll::chrono_literals;
|
using namespace ll::chrono_literals;
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
@@ -28,3 +27,9 @@ namespace VoteClean {
|
|||||||
extern void voteCommandExecute(Player* pl);
|
extern void voteCommandExecute(Player* pl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace UnloadActorClean {
|
||||||
|
|
||||||
|
extern void cleanUnloadActor();
|
||||||
|
|
||||||
|
}
|
||||||
+23
-28
@@ -1,44 +1,39 @@
|
|||||||
#include "Cleaner.h"
|
#include "Cleaner.h"
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
void setShouldIgnore(gmlib::GMActor* ac) { ac->addTag("cleaner:ignore"); }
|
||||||
void setShouldIgnore(GMLIB_Actor* ac) { ac->addTag("cleaner:ignore"); }
|
|
||||||
|
|
||||||
void ListenEvents() {
|
void ListenEvents() {
|
||||||
auto& eventBus = ll::event::EventBus::getInstance();
|
auto& eventBus = ll::event::EventBus::getInstance();
|
||||||
auto& config = Cleaner::Entry::getInstance().getConfig();
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
// ItemSpawnEvent
|
// ItemSpawnEvent
|
||||||
eventBus.emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
eventBus.emplaceListener<ila::mc::SpawnItemActorAfterEvent>([&config](ila::mc::SpawnItemActorAfterEvent& event) {
|
||||||
[&config](GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent& event) {
|
auto& item = event.itemActor();
|
||||||
auto& item = event.getItemActor();
|
if (event.spawner()) {
|
||||||
if (event.getSpawner().has_value()) {
|
auto pl = (gmlib::GMPlayer*)event.spawner();
|
||||||
auto pl = (GMLIB_Player*)event.getSpawner().as_ptr();
|
if (pl->isPlayer() && !pl->isAlive()) { // Death Drop
|
||||||
if (pl->isPlayer() && !pl->isAlive()) { // Death Drop
|
auto ac = (gmlib::GMActor*)&item;
|
||||||
auto ac = (GMLIB_Actor*)&item;
|
setShouldIgnore(ac);
|
||||||
setShouldIgnore(ac);
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.ItemDespawn.Enabled) {
|
||||||
|
item.lifeTime() = config.ItemDespawn.DespawnTime;
|
||||||
|
auto list = config.ItemDespawn.WhiteList;
|
||||||
|
auto type = item.item().getTypeName();
|
||||||
|
for (auto& key : list) {
|
||||||
|
if (isMatch(type, key)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.ItemDespawn.Enabled) {
|
item.lifeTime() = config.ItemDespawn.DespawnTime;
|
||||||
item.lifeTime() = config.ItemDespawn.DespawnTime;
|
|
||||||
auto list = config.ItemDespawn.WhiteList;
|
|
||||||
auto type = item.item().getTypeName();
|
|
||||||
for (auto& key : list) {
|
|
||||||
if (isMatch(type, key)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
item.lifeTime() = config.ItemDespawn.DespawnTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
// MobTakeItemEvent
|
// MobTakeItemEvent
|
||||||
eventBus.emplaceListener<GMLIB::Event::EntityEvent::MobPickupItemAfterEvent>(
|
eventBus.emplaceListener<ila::mc::ActorPickupItemAfterEvent>([](ila::mc::ActorPickupItemAfterEvent& event) {
|
||||||
[](GMLIB::Event::EntityEvent::MobPickupItemAfterEvent& event) {
|
auto mob = (gmlib::GMActor*)&event.self();
|
||||||
auto mob = (GMLIB_Actor*)&event.self();
|
setShouldIgnore(mob);
|
||||||
setShouldIgnore(mob);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Cleaner
|
} // namespace Cleaner
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
namespace Helper {
|
namespace Helper {
|
||||||
|
|
||||||
void broadcastMessage(std::string_view msg) {
|
void broadcastMessage(std::string_view msg) {
|
||||||
GMLIB_Level::getInstance()->broadcast(tr("cleaner.info.prefix") + std::string(msg));
|
gmlib::GMLevel::getInstance()->broadcast(tr("cleaner.info.prefix") + std::string(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void broadcastToast(std::string_view msg) {
|
void broadcastToast(std::string_view msg) {
|
||||||
GMLIB_Level::getInstance()->broadcastToast(tr("cleaner.info.prefix"), msg);
|
gmlib::GMLevel::getInstance()->broadcastToast(tr("cleaner.info.prefix"), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Helper
|
} // namespace Helper
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#include "Cleaner.h"
|
||||||
|
#include "Global.h"
|
||||||
|
#include "gmlib/mc/world/actor/UnloadedActor.h"
|
||||||
|
|
||||||
|
namespace UnloadActorClean {
|
||||||
|
void cleanUnloadActor() {
|
||||||
|
auto& config = Cleaner::Entry::getInstance().getConfig();
|
||||||
|
gmlib::UnloadedActor::foreachUnloadedActor(
|
||||||
|
[config](gmlib::UnloadedActor& actor) -> bool {
|
||||||
|
for (auto& actorname : config.UnloadActorClean.CleanList) {
|
||||||
|
if (actor.getTypeName() == actorname) {
|
||||||
|
actor.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} // namespace UnloadActorClean
|
||||||
@@ -9,8 +9,6 @@ int playerCount = 0;
|
|||||||
|
|
||||||
std::unordered_map<mce::UUID, bool> voteList;
|
std::unordered_map<mce::UUID, bool> voteList;
|
||||||
|
|
||||||
static std::shared_ptr<ll::schedule::task::Task<ll::chrono::ServerClock>> mAutoCleanTask;
|
|
||||||
|
|
||||||
int getPlayerCount() {
|
int getPlayerCount() {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
ll::service::getLevel()->forEachPlayer([&](Player& pl) -> bool {
|
ll::service::getLevel()->forEachPlayer([&](Player& pl) -> bool {
|
||||||
@@ -95,10 +93,16 @@ void voteClean(Player* pl) {
|
|||||||
Helper::broadcastToast(tr("cleaner.vote.voteMessage", {pl->getRealName()}));
|
Helper::broadcastToast(tr("cleaner.vote.voteMessage", {pl->getRealName()}));
|
||||||
}
|
}
|
||||||
sendVoteForm(pl);
|
sendVoteForm(pl);
|
||||||
auto cooldown = std::chrono::seconds::duration(config.VoteClean.Cooldown);
|
ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> {
|
||||||
auto waitTime = std::chrono::seconds::duration(config.VoteClean.CheckDelay);
|
co_await std::chrono::seconds::duration(config.VoteClean.Cooldown);
|
||||||
Cleaner::Entry::getInstance().getScheduler().add<DelayTask>(cooldown, [] { canVote = false; });
|
canVote = true;
|
||||||
Cleaner::Entry::getInstance().getScheduler().add<DelayTask>(waitTime, [] { checkVote(); });
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
|
ll::coro::keepThis([&config]() -> ll::coro::CoroTask<> {
|
||||||
|
co_await std::chrono::seconds::duration(config.VoteClean.CheckDelay);
|
||||||
|
checkVote();
|
||||||
|
co_return;
|
||||||
|
}).launch(ll::thread::ServerThreadExecutor::getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void confirmForm(Player* pl) {
|
void confirmForm(Player* pl) {
|
||||||
|
|||||||
+5
-3
@@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// IWYU pragma: begin_exports
|
||||||
#include "Mod.h"
|
#include "Mod.h"
|
||||||
#include <include_all.h>
|
#include "gmlib/include_lib.h"
|
||||||
|
#include "gmlib/include_ll.h"
|
||||||
|
#include "ila/include_all.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
// IWYU pragma: end_exports
|
||||||
|
|
||||||
#define S(x) std::to_string(x)
|
#define S(x) std::to_string(x)
|
||||||
|
|
||||||
extern ll::Logger logger;
|
|
||||||
|
|
||||||
extern void RegisterCommands();
|
extern void RegisterCommands();
|
||||||
|
|
||||||
namespace Helper {
|
namespace Helper {
|
||||||
|
|||||||
+19
-18
@@ -1,38 +1,41 @@
|
|||||||
|
#include "Mod.h"
|
||||||
#include "Features/Cleaner.h"
|
#include "Features/Cleaner.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
|
#include "ll/api/utils/ErrorUtils.h"
|
||||||
ll::Logger logger("Cleaner");
|
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
static std::unique_ptr<Entry> instance;
|
Entry& Entry::getInstance() {
|
||||||
|
static Entry instance;
|
||||||
Entry& Entry::getInstance() { return *instance; }
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
bool Entry::load() { return true; }
|
bool Entry::load() { return true; }
|
||||||
|
|
||||||
bool Entry::enable() {
|
bool Entry::enable() {
|
||||||
mConfig.emplace();
|
mConfig.emplace();
|
||||||
mScheduler.emplace();
|
try {
|
||||||
ll::config::loadConfig(*mConfig, getSelf().getConfigDir() / "config.json");
|
ll::config::loadConfig(*mConfig, getSelf().getConfigDir() / "config.json");
|
||||||
|
} catch (...) {
|
||||||
|
ll::error_utils::printCurrentException(getSelf().getLogger());
|
||||||
|
}
|
||||||
saveConfig();
|
saveConfig();
|
||||||
I18nAPI::updateOrCreateLanguageFile(getSelf().getLangDir(), "en_US", en_US);
|
gmlib::I18nAPI::updateOrCreateLanguageFile(getSelf().getLangDir(), "en_US", en_US);
|
||||||
I18nAPI::updateOrCreateLanguageFile(getSelf().getLangDir(), "zh_CN", zh_CN);
|
gmlib::I18nAPI::updateOrCreateLanguageFile(getSelf().getLangDir(), "zh_CN", zh_CN);
|
||||||
I18nAPI::loadLanguagesFromDirectory(getSelf().getLangDir());
|
gmlib::I18nAPI::loadLanguagesFromDirectory(getSelf().getLangDir());
|
||||||
Cleaner::ListenEvents();
|
Cleaner::ListenEvents();
|
||||||
RegisterCommands();
|
RegisterCommands();
|
||||||
Cleaner::loadCleaner();
|
Cleaner::loadCleaner();
|
||||||
logger.info("Cleaner Loaded!");
|
getSelf().getLogger().info("Cleaner Loaded!");
|
||||||
logger.info("Author: GroupMountain");
|
getSelf().getLogger().info("Author: GroupMountain");
|
||||||
logger.info("Repository: https://github.com/GroupMountain/Cleaner");
|
getSelf().getLogger().info("Repository: https://github.com/GroupMountain/Cleaner");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entry::disable() {
|
bool Entry::disable() {
|
||||||
mConfig.reset();
|
mConfig.reset();
|
||||||
Cleaner::unloadCleaner();
|
Cleaner::unloadCleaner();
|
||||||
mScheduler.reset();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,12 +43,10 @@ Config& Entry::getConfig() { return mConfig.value(); }
|
|||||||
|
|
||||||
void Entry::saveConfig() { ll::config::saveConfig(*mConfig, getSelf().getConfigDir() / "config.json"); }
|
void Entry::saveConfig() { ll::config::saveConfig(*mConfig, getSelf().getConfigDir() / "config.json"); }
|
||||||
|
|
||||||
ServerTimeScheduler& Entry::getScheduler() { return mScheduler.value(); }
|
|
||||||
|
|
||||||
} // namespace Cleaner
|
} // namespace Cleaner
|
||||||
|
|
||||||
LL_REGISTER_MOD(Cleaner::Entry, Cleaner::instance);
|
LL_REGISTER_MOD(Cleaner::Entry, Cleaner::Entry::getInstance());
|
||||||
|
|
||||||
std::string tr(std::string const& key, std::vector<std::string> const& params) {
|
std::string tr(std::string const& key, std::vector<std::string> const& params) {
|
||||||
return I18nAPI::get(key, params, Cleaner::Entry::getInstance().getConfig().language);
|
return gmlib::I18nAPI::get(key, params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,15 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include <ll/api/mod/NativeMod.h>
|
#include <ll/api/mod/NativeMod.h>
|
||||||
#include <ll/api/schedule/Scheduler.h>
|
|
||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
using namespace ll::schedule;
|
|
||||||
|
|
||||||
class Entry {
|
class Entry {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Entry& getInstance();
|
static Entry& getInstance();
|
||||||
|
|
||||||
Entry(ll::mod::NativeMod& self) : mSelf(self) {}
|
Entry() : mSelf(*ll::mod::NativeMod::current()) {}
|
||||||
|
|
||||||
[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }
|
[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }
|
||||||
|
|
||||||
@@ -34,12 +31,9 @@ public:
|
|||||||
|
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
|
|
||||||
ServerTimeScheduler& getScheduler();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ll::mod::NativeMod& mSelf;
|
ll::mod::NativeMod& mSelf;
|
||||||
std::optional<Config> mConfig;
|
std::optional<Config> mConfig;
|
||||||
std::optional<ServerTimeScheduler> mScheduler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Cleaner
|
} // namespace Cleaner
|
||||||
|
|||||||
+19
-21
@@ -1,5 +1,4 @@
|
|||||||
#include "Features/Cleaner.h"
|
#include "Features/Cleaner.h"
|
||||||
#include "Mod.h"
|
|
||||||
|
|
||||||
struct CleanerParam {
|
struct CleanerParam {
|
||||||
enum class Despawn { despawn } despawn;
|
enum class Despawn { despawn } despawn;
|
||||||
@@ -16,10 +15,8 @@ void RegCleanerCommand() {
|
|||||||
tr("cleaner.command.cleaner"),
|
tr("cleaner.command.cleaner"),
|
||||||
CommandPermissionLevel::GameDirectors
|
CommandPermissionLevel::GameDirectors
|
||||||
);
|
);
|
||||||
cmd.overload<CleanerParam>()
|
cmd.overload<CleanerParam>().required("despawn").required("entity").execute(
|
||||||
.required("despawn")
|
[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
||||||
.required("entity")
|
|
||||||
.execute<[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
|
||||||
auto ens = param.entity.results(origin);
|
auto ens = param.entity.results(origin);
|
||||||
if (ens.empty()) {
|
if (ens.empty()) {
|
||||||
return output.error(tr("cleaner.command.error.noTarget"));
|
return output.error(tr("cleaner.command.error.noTarget"));
|
||||||
@@ -28,15 +25,15 @@ void RegCleanerCommand() {
|
|||||||
en->despawn();
|
en->despawn();
|
||||||
}
|
}
|
||||||
return output.success(tr("cleaner.command.despawnSuccess", {S(ens.size())}));
|
return output.success(tr("cleaner.command.despawnSuccess", {S(ens.size())}));
|
||||||
}>();
|
}
|
||||||
cmd.overload<CleanerParam>()
|
);
|
||||||
.required("action")
|
cmd.overload<CleanerParam>().required("action").execute(
|
||||||
.execute<[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
||||||
switch (param.action) {
|
switch (param.action) {
|
||||||
case CleanerParam::Action::clean: {
|
case CleanerParam::Action::clean: {
|
||||||
Cleaner::CleanTask();
|
Cleaner::CleanTask();
|
||||||
if (Cleaner::Entry::getInstance().getConfig().Basic.ConsoleLog) {
|
if (Cleaner::Entry::getInstance().getConfig().Basic.ConsoleLog) {
|
||||||
logger.info(tr("cleaner.output.opClean"));
|
ll::io::LoggerRegistry::getInstance().getOrCreate("Cleaner")->info(tr("cleaner.output.opClean"));
|
||||||
}
|
}
|
||||||
if (Cleaner::Entry::getInstance().getConfig().Basic.SendBroadcast) {
|
if (Cleaner::Entry::getInstance().getConfig().Basic.SendBroadcast) {
|
||||||
Helper::broadcastMessage(tr("cleaner.output.opClean"));
|
Helper::broadcastMessage(tr("cleaner.output.opClean"));
|
||||||
@@ -47,15 +44,15 @@ void RegCleanerCommand() {
|
|||||||
return output.success(tr("cleaner.command.clean.output"));
|
return output.success(tr("cleaner.command.clean.output"));
|
||||||
}
|
}
|
||||||
case CleanerParam::Action::tps: {
|
case CleanerParam::Action::tps: {
|
||||||
return output.success(tr(
|
return output.success(
|
||||||
"cleaner.command.tps.output",
|
tr("cleaner.command.tps.output",
|
||||||
{S(GMLIB_Level::getLevel()->getServerCurrentTps()),
|
{S(gmlib::GMLevel::getInstance()->getServerCurrentTps()),
|
||||||
S(GMLIB_Level::getLevel()->getServerAverageTps())}
|
S(gmlib::GMLevel::getInstance()->getServerAverageTps())})
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
case CleanerParam::Action::mspt: {
|
case CleanerParam::Action::mspt: {
|
||||||
return output.success(
|
return output.success(
|
||||||
tr("cleaner.command.mspt.output", {S(GMLIB_Level::getLevel()->getServerMspt())})
|
tr("cleaner.command.mspt.output", {S(gmlib::GMLevel::getInstance()->getServerMspt())})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case CleanerParam::Action::reload: {
|
case CleanerParam::Action::reload: {
|
||||||
@@ -63,15 +60,16 @@ void RegCleanerCommand() {
|
|||||||
return output.success(tr("cleaner.output.reload"));
|
return output.success(tr("cleaner.output.reload"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}>();
|
}
|
||||||
|
);
|
||||||
cmd.overload<CleanerParam>()
|
cmd.overload<CleanerParam>()
|
||||||
.required("despawntime")
|
.required("despawntime")
|
||||||
.required("ticks")
|
.required("ticks")
|
||||||
.execute<[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
.execute([&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
||||||
Cleaner::Entry::getInstance().getConfig().ItemDespawn.DespawnTime = param.ticks;
|
Cleaner::Entry::getInstance().getConfig().ItemDespawn.DespawnTime = param.ticks;
|
||||||
Cleaner::Entry::getInstance().saveConfig();
|
Cleaner::Entry::getInstance().saveConfig();
|
||||||
return output.success(tr("cleaner.command.despawntime", {S(param.ticks)}));
|
return output.success(tr("cleaner.command.despawntime", {S(param.ticks)}));
|
||||||
}>();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
void RegVoteCommand() {
|
void RegVoteCommand() {
|
||||||
@@ -80,13 +78,13 @@ void RegVoteCommand() {
|
|||||||
tr("cleaner.command.voteclean"),
|
tr("cleaner.command.voteclean"),
|
||||||
CommandPermissionLevel::Any
|
CommandPermissionLevel::Any
|
||||||
);
|
);
|
||||||
cmd.overload().execute<[&](CommandOrigin const& origin, CommandOutput& output) {
|
cmd.overload().execute([&](CommandOrigin const& origin, CommandOutput& output) {
|
||||||
if (origin.getOriginType() == CommandOriginType::Player) {
|
if (origin.getOriginType() == CommandOriginType::Player) {
|
||||||
auto pl = (Player*)origin.getEntity();
|
auto pl = (Player*)origin.getEntity();
|
||||||
return VoteClean::voteCommandExecute(pl);
|
return VoteClean::voteCommandExecute(pl);
|
||||||
}
|
}
|
||||||
return output.error(tr("cleaner.command.error.playerOnly"));
|
return output.error(tr("cleaner.command.error.playerOnly"));
|
||||||
}>();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterCommands() {
|
void RegisterCommands() {
|
||||||
|
|||||||
+48
-23
@@ -1,28 +1,53 @@
|
|||||||
{
|
{
|
||||||
"format_version": 2,
|
"format_version": 3,
|
||||||
"tooth": "github.com/GroupMountain/Cleaner",
|
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
||||||
"version": "0.13.2",
|
"tooth": "github.com/GroupMountain/Cleaner",
|
||||||
"info": {
|
"version": "0.13.7",
|
||||||
"name": "Cleaner",
|
"info": {
|
||||||
"description": "A Powerful Entities Cleaning up Mod for BDS",
|
"name": "Cleaner",
|
||||||
"author": "GroupMountain",
|
"description": "A Powerful Entities Cleaning up Mod for BDS",
|
||||||
"source": "github.com/GroupMountain/Cleaner",
|
"tags": [
|
||||||
"tags": [
|
"levilamina",
|
||||||
"levilamina",
|
"cleaner",
|
||||||
"cleaner",
|
"gmlib"
|
||||||
"gmlib"
|
],
|
||||||
]
|
"avatar_url": ""
|
||||||
},
|
},
|
||||||
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.13.2/Cleaner-windows-x64.zip",
|
"variants": [
|
||||||
"dependencies": {
|
{
|
||||||
"github.com/GroupMountain/GMLIB": ">=0.13.7"
|
"label": "",
|
||||||
},
|
"platform": "win-x64",
|
||||||
"files": {
|
"dependencies": {
|
||||||
"place": [
|
"github.com/GroupMountain/GMLIB": ">=1.3.0",
|
||||||
|
"github.com/MiracleForest/iListenAttentively-Release": ">=0.6.0"
|
||||||
|
},
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"type": "zip",
|
||||||
|
"urls": [
|
||||||
|
"https://github.com/GroupMountain/Cleaner/releases/download/v0.13.7/Cleaner-windows-x64.zip"
|
||||||
|
],
|
||||||
|
"placements": [
|
||||||
{
|
{
|
||||||
"src": "Cleaner/*",
|
"type": "dir",
|
||||||
"dest": "mods/Cleaner"
|
"src": "Cleaner/",
|
||||||
|
"dest": "plugins/Cleaner"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preserve_files": [],
|
||||||
|
"remove_files": [],
|
||||||
|
"scripts": {
|
||||||
|
"pre_install": [],
|
||||||
|
"install": [],
|
||||||
|
"post_install": [],
|
||||||
|
"pre_pack": [],
|
||||||
|
"post_pack": [],
|
||||||
|
"pre_uninstall": [],
|
||||||
|
"uninstall": [],
|
||||||
|
"post_uninstall": []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,17 @@ add_rules("mode.debug", "mode.release", "mode.releasedbg")
|
|||||||
|
|
||||||
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
|
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
|
||||||
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
|
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
|
||||||
|
add_repositories("miracleforest https://github.com/MiracleForest/xmake-repo")
|
||||||
|
|
||||||
if not has_config("vs_runtime") then
|
if not has_config("vs_runtime") then
|
||||||
set_runtimes("MD")
|
set_runtimes("MD")
|
||||||
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")
|
add_requires("levilamina 1.3.2")
|
||||||
add_requires("gmlib 0.13.7")
|
add_requires("levibuildscript 0.4.1")
|
||||||
|
add_requires("gmlib 1.3.0")
|
||||||
|
add_requires("ilistenattentively 0.6.0")
|
||||||
|
|
||||||
target("Cleaner") -- Change this to your mod name.
|
target("Cleaner") -- Change this to your mod name.
|
||||||
add_cxflags(
|
add_cxflags(
|
||||||
@@ -24,14 +27,19 @@ target("Cleaner") -- Change this to your mod name.
|
|||||||
)
|
)
|
||||||
add_packages(
|
add_packages(
|
||||||
"levilamina",
|
"levilamina",
|
||||||
"gmlib"
|
"gmlib",
|
||||||
|
"ilistenattentively"
|
||||||
)
|
)
|
||||||
add_shflags(
|
add_defines(
|
||||||
"/DELAYLOAD:bedrock_server.dll"
|
"NOMINMAX",
|
||||||
|
"UNICODE",
|
||||||
|
"_HAS_CXX23=1"
|
||||||
)
|
)
|
||||||
|
add_rules("@levibuildscript/linkrule")
|
||||||
set_exceptions("none")
|
set_exceptions("none")
|
||||||
set_kind("shared")
|
set_kind("shared")
|
||||||
set_languages("cxx23")
|
set_languages("cxx20")
|
||||||
|
set_symbols("debug")
|
||||||
|
|
||||||
after_build(function (target)
|
after_build(function (target)
|
||||||
local mod_packer = import("scripts.after_build")
|
local mod_packer = import("scripts.after_build")
|
||||||
|
|||||||
Reference in New Issue
Block a user