adapt: adapt GMLIB v0.9.8
This commit is contained in:
+1
-1
Submodule SDK-GMLIB updated: 1a7e0ba55d...cda5bfbf85
@@ -2,6 +2,9 @@
|
||||
"name": "${pluginName}",
|
||||
"entry": "${pluginFile}",
|
||||
"type": "native",
|
||||
"version": "0.9.0",
|
||||
"author": "GroupMountain",
|
||||
"description": "Better Death Messages",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "GMLIB"
|
||||
|
||||
@@ -45,7 +45,7 @@ void ListenEvents() {
|
||||
auto msg = ev.getDeathMessage();
|
||||
auto info = tr(msg.first, msg.second);
|
||||
deathLogger.info(info);
|
||||
ev.setDeathMessage({info, msg.second});
|
||||
ev.getDeathMessage() = {info, msg.second};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#include <memory>
|
||||
|
||||
#include <ll/api/plugin/NativePlugin.h>
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace plugin {
|
||||
|
||||
// The global plugin instance.
|
||||
std::unique_ptr<Plugin> plugin = nullptr;
|
||||
|
||||
extern "C" {
|
||||
_declspec(dllexport) bool ll_plugin_load(ll::plugin::NativePlugin& self) {
|
||||
plugin = std::make_unique<plugin::Plugin>(self);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @warning Unloading the plugin may cause a crash if the plugin has not released all of its
|
||||
/// resources. If you are unsure, keep this function commented out.
|
||||
// _declspec(dllexport) bool ll_plugin_unload(ll::plugin::Plugin&) {
|
||||
// plugin.reset();
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
_declspec(dllexport) bool ll_plugin_enable(ll::plugin::NativePlugin&) { return plugin->enable(); }
|
||||
|
||||
_declspec(dllexport) bool ll_plugin_disable(ll::plugin::NativePlugin&) { return plugin->disable(); }
|
||||
}
|
||||
|
||||
} // namespace plugin
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "Entry.h"
|
||||
#include "Global.h"
|
||||
|
||||
ll::Logger logger(PLUGIN_NAME);
|
||||
|
||||
namespace DeathMessages {
|
||||
|
||||
std::unique_ptr<Entry>& Entry::getInstance() {
|
||||
static std::unique_ptr<Entry> instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool Entry::load() {
|
||||
initPlugin();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Entry::enable() {
|
||||
RegisterDamageDefinition();
|
||||
ListenEvents();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Entry::disable() { return true; }
|
||||
|
||||
} // namespace DeathMessages
|
||||
|
||||
LL_REGISTER_PLUGIN(DeathMessages::Entry, DeathMessages::Entry::getInstance());
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include <ll/api/plugin/NativePlugin.h>
|
||||
|
||||
namespace DeathMessages {
|
||||
|
||||
class Entry {
|
||||
|
||||
public:
|
||||
static std::unique_ptr<Entry>& getInstance();
|
||||
|
||||
Entry(ll::plugin::NativePlugin& self) : mSelf(self) {}
|
||||
|
||||
[[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();
|
||||
|
||||
/// @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();
|
||||
|
||||
private:
|
||||
ll::plugin::NativePlugin& mSelf;
|
||||
};
|
||||
|
||||
} // namespace DeathMessages
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#define LL_MEMORY_OPERATORS
|
||||
|
||||
#include "ll/api/memory/MemoryOperators.h" // IWYU pragma: keep
|
||||
@@ -1,38 +0,0 @@
|
||||
#include "Plugin.h"
|
||||
#include "Global.h"
|
||||
|
||||
ll::Logger logger(PLUGIN_NAME);
|
||||
|
||||
namespace plugin {
|
||||
|
||||
Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
|
||||
// Code for loading the plugin goes here.
|
||||
initPlugin();
|
||||
}
|
||||
|
||||
bool Plugin::enable() {
|
||||
// Code for enabling the plugin goes here.
|
||||
auto requireLibVersion = SemVersion(0, 8, 2, "", "");
|
||||
if (GMLIB::Version::checkLibVersionMatch(requireLibVersion)) {
|
||||
RegisterDamageDefinition();
|
||||
ListenEvents();
|
||||
logger.info("DeathMessages Loaded!");
|
||||
logger.info("Author: GroupMountain");
|
||||
logger.info("Repository: https://github.com/GroupMountain/DeathMessages");
|
||||
} else {
|
||||
logger.error("GMLIB Version is outdated! Please update your GMLIB!");
|
||||
logger.error(
|
||||
"Current GMLIB Version {}, Required Lowest GMLIB Version {}",
|
||||
GMLIB::Version::getLibVersionString(),
|
||||
requireLibVersion.asString()
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Plugin::disable() {
|
||||
// Code for disabling the plugin goes here.
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace plugin
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
#include <ll/api/plugin/NativePlugin.h>
|
||||
|
||||
namespace plugin {
|
||||
|
||||
class Plugin {
|
||||
public:
|
||||
explicit Plugin(ll::plugin::NativePlugin& self);
|
||||
|
||||
Plugin(Plugin&&) = delete;
|
||||
Plugin(const Plugin&) = delete;
|
||||
Plugin& operator=(Plugin&&) = delete;
|
||||
Plugin& operator=(const Plugin&) = delete;
|
||||
|
||||
~Plugin() = default;
|
||||
|
||||
/// @return True if the plugin is enabled successfully.
|
||||
bool enable();
|
||||
|
||||
/// @return True if the plugin is disabled successfully.
|
||||
bool disable();
|
||||
|
||||
private:
|
||||
ll::plugin::NativePlugin& mSelf;
|
||||
};
|
||||
|
||||
} // namespace plugin
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": 2,
|
||||
"tooth": "github.com/GroupMountain/DeathMessages",
|
||||
"version": "0.8.0",
|
||||
"version": "0.9.0",
|
||||
"info": {
|
||||
"name": "DeathMessages",
|
||||
"description": "Better Death Messages on MCBE",
|
||||
@@ -11,9 +11,9 @@
|
||||
"DeathMessages"
|
||||
]
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/DeathMessages/releases/download/v0.8.0/DeathMessages-windows-x64.zip",
|
||||
"asset_url": "https://github.com/GroupMountain/DeathMessages/releases/download/v0.9.0/DeathMessages-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.8.2"
|
||||
"github.com/GroupMountain/GMLIB": ">=0.9.8"
|
||||
},
|
||||
"files": {
|
||||
"place": [
|
||||
|
||||
Reference in New Issue
Block a user