adapt: adapt LeviLamina v0.12.1

This commit is contained in:
Tsubasa6848
2024-04-29 07:04:48 +08:00
Unverified
parent 63586f62cb
commit 8321181be5
18 changed files with 341 additions and 405 deletions
+27 -10
View File
@@ -1,19 +1,24 @@
#pragma once
#include "Config.h"
#include <ll/api/plugin/NativePlugin.h>
#include <ll/api/schedule/Scheduler.h>
namespace plugin {
namespace Cleaner {
using namespace ll::schedule;
class Entry {
class Plugin {
public:
explicit Plugin(ll::plugin::NativePlugin& self);
static Entry& getInstance();
Plugin(Plugin&&) = delete;
Plugin(const Plugin&) = delete;
Plugin& operator=(Plugin&&) = delete;
Plugin& operator=(const Plugin&) = delete;
Entry(ll::plugin::NativePlugin& self) : mSelf(self) {}
~Plugin() = default;
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; }
/// @return True if the plugin is loaded successfully.
bool load();
/// @return True if the plugin is enabled successfully.
bool enable();
@@ -21,8 +26,20 @@ public:
/// @return True if the plugin is disabled successfully.
bool disable();
// TODO: Implement this method if you need to unload the plugin.
// /// @return True if the plugin is unloaded successfully.
// bool unload();
Config& getConfig();
void saveConfig();
ServerTimeScheduler& getScheduler();
private:
ll::plugin::NativePlugin& mSelf;
ll::plugin::NativePlugin& mSelf;
std::optional<Config> mConfig;
std::optional<ServerTimeScheduler> mScheduler;
};
} // namespace plugin
} // namespace Cleaner