Skip to content

Commit

Permalink
Finally fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LordBombardir committed Jan 1, 2025
1 parent e4b4eb9 commit ad7e68e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/mod/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include "manager/command/CommandManager.h"
#include "manager/lang/LanguageManager.h"
#include <ll/api/mod/RegisterHelper.h>
#include <memory>

namespace power_ranks {

static std::unique_ptr<Main> instance;

Main& Main::getInstance() { return *instance; }
Main& Main::getInstance() {
static Main instance;
return instance;
}

bool Main::load() {
getSelf().getLogger().info("The mod is loading...");
Expand Down Expand Up @@ -54,4 +54,4 @@ bool Main::disable() {

} // namespace power_ranks

LL_REGISTER_MOD(power_ranks::Main, *power_ranks::instance);
LL_REGISTER_MOD(power_ranks::Main, power_ranks::Main::getInstance());
2 changes: 1 addition & 1 deletion src/mod/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Main {
public:
static Main& getInstance();

Main(ll::mod::NativeMod& self) : mSelf(self) {}
Main() : mSelf(*ll::mod::NativeMod::current()) {}

[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }

Expand Down
4 changes: 3 additions & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ if not has_config("vs_runtime") then
end

target("PowerRanks") -- Change this to your mod name.
add_rules("@levibuildscript/linkrule")
add_rules("@levibuildscript/modpacker")

add_cxflags(
"/EHa",
"/utf-8",
Expand All @@ -29,7 +32,6 @@ target("PowerRanks") -- Change this to your mod name.
add_includedirs("src")
add_packages("levilamina")
add_packages("sqlitecpp")
add_shflags("/DELAYLOAD:bedrock_runtime.dll")
set_exceptions("none") -- To avoid conflicts with /EHa.
set_kind("shared")
set_languages("c++20")
Expand Down

0 comments on commit ad7e68e

Please sign in to comment.