feat: add auto clean task
This commit is contained in:
+5
-2
@@ -104,8 +104,11 @@ void CleanTask() {
|
||||
});
|
||||
}
|
||||
|
||||
void CountEntitiesTask() {
|
||||
//
|
||||
void AutoCleanTask() {
|
||||
auto_clean_task->cancel();
|
||||
auto_clean_task = scheduler.add<RepeatTask>(1min, [] {
|
||||
CleanTask();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Cleaner
|
||||
@@ -5,7 +5,9 @@
|
||||
extern ll::Logger logger;
|
||||
extern void RegisterCommands();
|
||||
extern void UnregisterCommands();
|
||||
static std::shared_ptr<ll::schedule::task::Task<ll::chrono::GameTimeClock>> auto_clean_task;
|
||||
|
||||
namespace Cleaner {
|
||||
extern void CleanTask();
|
||||
extern void AutoCleanTask();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
|
||||
|
||||
bool Plugin::enable() {
|
||||
RegisterCommands();
|
||||
Cleaner::AutoCleanTask();
|
||||
logger.info("Cleaner Loaded!");
|
||||
logger.info("Author: Tsubasa6848");
|
||||
logger.info("Repository: https://github.com/GroupMountain/Cleaner");
|
||||
@@ -19,6 +20,7 @@ bool Plugin::enable() {
|
||||
bool Plugin::disable() {
|
||||
logger.info("Disabling Cleaner...");
|
||||
// Code for disabling the plugin goes here.
|
||||
auto_clean_task->cancel();
|
||||
UnregisterCommands();
|
||||
logger.info("Cleaner Disabled!");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user