adapt: adapt GMLIB v0.13.7 and LeviLamina v0.13.5

This commit is contained in:
子沐呀
2024-12-07 19:01:04 +08:00
Unverified
parent 02ef60b69c
commit d8ca1764c1
9 changed files with 42 additions and 38 deletions
+3 -4
View File
@@ -2,7 +2,7 @@
#include "Global.h"
#include "Language.h"
ll::Logger logger(PLUGIN_NAME);
ll::Logger logger(MOD_NAME);
namespace InventoryCheck {
@@ -26,7 +26,6 @@ bool Entry::load() {
tr("error.protocolMismatch.version",
{std::to_string(TARGET_PROTOCOL), std::to_string(GMLIB::Version::getProtocolVersion())})
);
return false;
}
return true;
}
@@ -40,7 +39,7 @@ bool Entry::enable() {
}
bool Entry::disable() {
// Code for disabling the plugin goes here.
// Code for disabling the mod goes here.
return true;
}
@@ -55,7 +54,7 @@ LangI18n& Entry::getI18n() { return mI18n.value(); }
} // namespace InventoryCheck
LL_REGISTER_PLUGIN(InventoryCheck::Entry, InventoryCheck::Entry::getInstance());
LL_REGISTER_MOD(InventoryCheck::Entry, InventoryCheck::Entry::getInstance());
std::string tr(std::string const& key, std::vector<std::string> const& data) {
return InventoryCheck::Entry::getInstance()->getI18n().get(key, data);
+9 -7
View File
@@ -1,4 +1,6 @@
#pragma once
#include <span>
#include "Config.h"
#include "Global.h"
@@ -11,20 +13,20 @@ class Entry {
public:
static std::unique_ptr<Entry>& getInstance();
Entry(ll::plugin::NativePlugin& self) : mSelf(self) {}
Entry(ll::mod::NativeMod& self) : mSelf(self) {}
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; }
[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }
/// @return True if the plugin is loaded successfully.
/// @return True if the mod is loaded successfully.
bool load();
/// @return True if the plugin is enabled successfully.
/// @return True if the mod is enabled successfully.
bool enable();
/// @return True if the plugin is disabled successfully.
/// @return True if the mod is disabled successfully.
bool disable();
/// @return True if the plugin is unloaded successfully.
/// @return True if the mod is unloaded successfully.
bool unload();
Config& getConfig();
@@ -32,7 +34,7 @@ public:
LangI18n& getI18n();
private:
ll::plugin::NativePlugin& mSelf;
ll::mod::NativeMod& mSelf;
std::optional<Config> mConfig;
std::optional<LangI18n> mI18n;
};
+5 -2
View File
@@ -1,8 +1,11 @@
#pragma once
#include <span>
#include <include_all.h>
#define PLUGIN_NAME "InventoryCheck"
#define TARGET_PROTOCOL 685
#define MOD_NAME "InventoryCheck"
#define TARGET_PROTOCOL 686
extern ll::Logger logger;
+2 -2
View File
@@ -1,5 +1,5 @@
// This file will make your plugin use LeviLamina's memory operators by default.
// This improves the memory management of your plugin and is recommended to use.
// This file will make your mod use LeviLamina's memory operators by default.
// This improves the memory management of your mod and is recommended to use.
#define LL_MEMORY_OPERATORS