10 Commits

14 changed files with 298 additions and 237 deletions
+22 -22
View File
@@ -7,33 +7,33 @@ jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
- name: Setup XMake
uses: xmake-io/github-action-setup-xmake@v1
- name: Cache
uses: actions/cache@v4
with:
submodules: recursive
path: |
~/AppData/Local/.xmake
key: xmake-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-
- uses: actions/checkout@v4
- name: Update Repo
run: xmake repo -u
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master
- run: |
xmake repo -u
- name: Update Project
run: xmake f -a x64 -m release -p windows -v -y
- run: |
xmake f -a x64 -m release -p windows -v -y
- name: Build Project
run: xmake -v -y
- run: |
xmake -w -y
- uses: actions/upload-artifact@v3
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: |
bin/DLL/
- uses: actions/upload-artifact@v3
with:
name: PDB
path: |
bin/PDB/
bin/
+32 -41
View File
@@ -7,36 +7,36 @@ jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
- name: Setup XMake
uses: xmake-io/github-action-setup-xmake@v1
- name: Cache
uses: actions/cache@v4
with:
submodules: recursive
path: |
~/AppData/Local/.xmake
key: xmake-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-
- uses: actions/checkout@v4
- name: Update Repo
run: xmake repo -u
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master
- run: |
xmake repo -u
- name: Update Project
run: xmake f -a x64 -m release -p windows -v -y
- run: |
xmake f -a x64 -m release -p windows -v -y
- name: Build Project
run: xmake -v -y
- run: |
xmake -w -y
- uses: actions/upload-artifact@v3
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: |
bin/DLL/
- uses: actions/upload-artifact@v3
with:
name: PDB
path: |
bin/PDB/
bin/
upload-to-release:
needs:
@@ -45,35 +45,26 @@ jobs:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4
- name: Download Plugin
uses: actions/download-artifact@v3
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: release/Plugin/
path: artifact
- name: Download PDB
uses: actions/download-artifact@v3
with:
name: PDB
path: release/PDB/
- name: Copy additional files
- name: Copy Files
run: |
cp LICENSE README.md release/Plugin/
cp LICENSE README.md artifact/
- name: Archive release
- name: Compress Artifact
run: |
cd release/Plugin
zip -r ../${{ github.event.repository.name }}-windows-x64.zip *
cd ..
working-directory: artifact
- name: Create GitHub Release
id: create_release
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
release/${{ github.event.repository.name }}-windows-x64.zip
release/PDB/${{ github.event.repository.name }}.pdb
${{ github.event.repository.name }}-windows-x64.zip
+1
View File
@@ -16,3 +16,4 @@ build/
/CMakeLists.txt
/bin
.cache/clangd/index
/.idea
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "${pluginName}",
"entry": "${pluginFile}",
"version": "0.13.0",
"name": "${modName}",
"entry": "${modFile}",
"version": "0.16.1",
"author": "GroupMountain",
"description": "Check Player's Inventory",
"type": "native",
+7 -7
View File
@@ -82,7 +82,7 @@ function string_formatter(str, variables)
end)
end
function pack_plugin(target,plugin_define)
function pack_mod(target,mod_define)
import("lib.detect.find_file")
local manifest_path = find_file("manifest.json", os.projectdir())
@@ -90,9 +90,9 @@ function pack_plugin(target,plugin_define)
local manifest = io.readfile(manifest_path)
local bindir = path.join(os.projectdir(), "bin/DLL")
local pdbdir = path.join(os.projectdir(), "bin/PDB")
local outputdir = path.join(bindir, plugin_define.pluginName)
local targetfile = path.join(outputdir, plugin_define.pluginFile)
local pdbfile = path.join(pdbdir, path.basename(plugin_define.pluginFile) .. ".pdb")
local outputdir = path.join(bindir, mod_define.modName)
local targetfile = path.join(outputdir, mod_define.modFile)
local pdbfile = path.join(pdbdir, path.basename(mod_define.modFile) .. ".pdb")
local manifestfile = path.join(outputdir, "manifest.json")
local oritargetfile = target:targetfile()
local oripdbfile = path.join(path.directory(oritargetfile), path.basename(oritargetfile) .. ".pdb")
@@ -103,9 +103,9 @@ function pack_plugin(target,plugin_define)
os.cp(oripdbfile, pdbfile)
end
formattedmanifest = string_formatter(manifest, plugin_define)
formattedmanifest = string_formatter(manifest, mod_define)
io.writefile(manifestfile,formattedmanifest)
cprint("${bright green}[Plugin Packer]: ${reset}plugin already generated to " .. outputdir)
cprint("${bright green}[Mod Packer]: ${reset}mod already generated to " .. outputdir)
else
cprint("${bright yellow}warn: ${reset}not found manifest.json in root dir!")
end
@@ -113,7 +113,7 @@ end
return {
pack_plugin = pack_plugin,
pack_mod = pack_mod,
beautify_json = beautify_json,
string_formatter = string_formatter
}
+17 -9
View File
@@ -1,18 +1,26 @@
#include "Global.h"
#include "mc/server/commands/CommandRegistry.h"
#include "mc/server/commands/CommandOutput.h"
#include "ll/api/command/CommandHandle.h"
#include "ll/api/service/Bedrock.h"
#include "gmlib/mc/world/actor/Actor.h"
void RegisterCommand() {
auto& cmd = ll::command::CommandRegistrar::getInstance().getOrCreateCommand(
auto& cmd = ll::command::CommandRegistrar::getInstance(false).getOrCreateCommand(
"inventorycheck",
tr("command.inventorycheck.desc"),
CommandPermissionLevel::GameDirectors
);
ll::service::getCommandRegistry()->registerAlias("inventorycheck", "ic");
cmd.overload().execute<[&](CommandOrigin const& origin, CommandOutput& output) {
auto entity = (GMLIB_Actor*)origin.getEntity();
if (entity && entity->isPlayer()) {
auto pl = (Player*)entity;
return mainForm(*pl);
}
return output.error(tr("command.error.console"));
}>();
cmd.overload().execute([](CommandOrigin const& origin, CommandOutput& output) {
auto entity = (gmlib::GMActor*)origin.getEntity();
if (entity && entity->isPlayer()) {
auto pl = (Player*)entity;
return mainForm(*pl);
}
return output.error(tr("command.error.console"));
});
}
+23 -20
View File
@@ -2,12 +2,21 @@
#include "Global.h"
#include "Language.h"
ll::Logger logger(PLUGIN_NAME);
#include "ll/api/Config.h"
#include "ll/api/Versions.h"
#include "ll/api/mod/RegisterHelper.h"
#include "gmlib/gm/i18n/LangI18n.h"
#include "gmlib/gm/i18n/JsonI18n.h"
#include "gmlib/gm/data/UserCache.h"
#include "ll/api/service/Bedrock.h"
#include "ll/api/service/PlayerInfo.h"
namespace InventoryCheck {
std::unique_ptr<Entry>& Entry::getInstance() {
static std::unique_ptr<Entry> instance;
Entry& Entry::getInstance() {
static Entry instance;
return instance;
}
@@ -20,34 +29,28 @@ bool Entry::load() {
mI18n->updateOrCreateLanguage("en_US", en_US);
mI18n->updateOrCreateLanguage("zh_CN", zh_CN);
mI18n->loadAllLanguages();
if (GMLIB::Version::getProtocolVersion() != TARGET_PROTOCOL) {
logger.error(tr("error.protocolMismatch.info"));
logger.error(
tr("error.protocolMismatch.version",
{std::to_string(TARGET_PROTOCOL), std::to_string(GMLIB::Version::getProtocolVersion())})
);
return false;
if (ll::getNetworkProtocolVersion() != TARGET_PROTOCOL) {
getSelf().getLogger().error(tr("error.protocolMismatch.info"));
getSelf().getLogger().error(tr("error.protocolMismatch.version", {std::to_string(ll::getNetworkProtocolVersion()), std::to_string(TARGET_PROTOCOL)}));
}
return true;
}
;
bool Entry::enable() {
RegisterCommand();
logger.info("InventoryCheck Loaded!");
logger.info("Author: GroupMountain");
logger.info("Repository: https://github.com/GroupMountain/InventoryCheck");
return true;
}
bool Entry::disable() {
// Code for disabling the plugin goes here.
// Code for disabling the mod goes here.
return true;
}
bool Entry::unload() {
getInstance().reset();
return true;
}
Config& Entry::getConfig() { return mConfig.value(); }
@@ -55,8 +58,8 @@ 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);
return InventoryCheck::Entry::getInstance().getI18n().get(key, data);
}
+18 -10
View File
@@ -1,38 +1,46 @@
#pragma once
#include <span>
#include "Config.h"
#include "Global.h"
#include "gmlib/gm/i18n/LangI18n.h"
#include "gmlib/gm/data/UserCache.h"
#include <memory>
namespace InventoryCheck {
using namespace GMLIB::Files::I18n;
using namespace gmlib::i18n;
class Entry {
public:
static std::unique_ptr<Entry>& getInstance();
static Entry& getInstance();
Entry(ll::plugin::NativePlugin& self) : mSelf(self) {}
Entry() : mSelf((*ll::mod::NativeMod::current())) {}
[[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.
bool unload();
/// @return True if the mod is unloaded successfully.
Config& getConfig();
LangI18n& getI18n();
std::vector<gmlib::UserCache::UserCacheEntry> userCache;
private:
ll::plugin::NativePlugin& mSelf;
ll::mod::NativeMod& mSelf;
std::optional<Config> mConfig;
std::optional<LangI18n> mI18n;
};
+9 -4
View File
@@ -1,10 +1,15 @@
#pragma once
#include <include_all.h>
#define PLUGIN_NAME "InventoryCheck"
#define TARGET_PROTOCOL 685
#include <span>
#include "mc/world/actor/player/Player.h"
#include <string>
#include <vector>
#define MOD_NAME "InventoryCheck"
#define TARGET_PROTOCOL 944
extern ll::Logger logger;
extern std::string tr(std::string const& key, std::vector<std::string> const& data = {});
+115 -33
View File
@@ -1,42 +1,92 @@
#include "Global.h"
#include "Entry.h"
bool saveInventory(Player& player) {
auto& pl = static_cast<GMLIB_Player&>(player);
#include <filesystem>
#include <unordered_map>
#include "mc/world/level/Level.h"
#include "mc/world/level/storage/DBStorage.h"
#include "mc/world/actor/player/PlayerListEntry.h"
#include "ll/api/service/Bedrock.h"
#include "ll/api/io/FileUtils.h"
#include "ll/api/form/ModalForm.h"
#include "ll/api/form/SimpleForm.h"
#include "ll/api/form/CustomForm.h"
#include "gmlib/mc/world/actor/OfflinePlayer.h"
#include <ll/api/service/PlayerInfo.h>
/**
* @brief the keys of the playr nbt that would be copied or written
*/
static constexpr const char* InvKey[] = {
"Armor","Offhand","Inventory","EnderChestInventory"
};
void saveInventory(Player& player) {
auto& pl = static_cast<gmlib::GMPlayer&>(player);
auto uuid = pl.getUuid();
ll::file_utils::writeFile(
"./plugins/InventoryCheck/save/" + uuid.asString() + ".dat",
pl.getNbt()->toBinaryNbt(),
true
);
return false;
}
/**
* @brief set the playerNBT easily and validly
*/
bool validSetNbt(mce::UUID uuid, const std::unique_ptr<CompoundTag>& nbt) {
if (!nbt) return false;
if (auto* p = ll::service::getLevel()->getPlayer(uuid)) {
auto& pl = static_cast<gmlib::GMPlayer&>(*p);
pl.setNbt(*nbt);
pl.refreshInventory();
return true;
}
auto db = ll::service::getDBStorage();
if (!db) return false;
auto tag = db->getCompoundTag("player_" + uuid.asString(), DBHelpers::Category::Player);
if (!tag || !tag->contains("ServerId"))
return false;
gmlib::OfflinePlayer(uuid, tag->at("ServerId")).setNbt(*nbt);
return true;
}
bool resumeInventory(Player& player) {
auto& pl = static_cast<GMLIB_Player&>(player);
auto& pl = static_cast<gmlib::GMPlayer&>(player);
auto uuid = pl.getUuid();
std::string path = "./plugins/InventoryCheck/save/" + uuid.asString() + ".dat";
if (auto binaryData = ll::file_utils::readFile(path, true)) {
std::filesystem::remove(path);
if (auto nbt = CompoundTag::fromBinaryNbt(binaryData.value())) {
GMLIB_Player::setPlayerNbtTags(uuid, *nbt, {"Offhand", "Inventory", "Armor", "EnderChestInventory"});
auto playerNbt=pl.getNbt();
for (auto key : InvKey)
playerNbt->mTags[key] = nbt->at(key);
pl.setNbt(*playerNbt);
pl.refreshInventory();
return true;
}
}
return false;
}
void mainForm(Player& pl) {
auto fm = ll::form::SimpleForm(tr("form.main.title"), tr("form.main.content"));
fm.appendButton(tr("form.main.checkOnline"), [](Player& pl) { return checkOnlineForm(pl); });
fm.appendButton(tr("form.main.checkAll"), [](Player& pl) { return checkAllForm(pl); });
fm.appendButton(tr("form.main.searchPlayer"), [](Player& pl) { return searchPlayerForm(pl); });
fm.appendButton(tr("form.main.resumeInventory"), [](Player& pl) {
auto res = resumeInventory(pl);
if (res) {
return pl.sendMessage(tr("resumeInventory.success"));
}
return pl.sendMessage(tr("resumeInventory.failed"));
pl.sendMessage(resumeInventory(pl)
? tr("resumeInventory.success")
: tr("resumeInventory.failed"));
});
fm.sendTo(pl);
}
@@ -44,7 +94,7 @@ void mainForm(Player& pl) {
void checkOnlineForm(Player& pl) {
auto fm = ll::form::SimpleForm(tr("form.checkList.title"), tr("form.checkList.content"));
std::unordered_map<mce::UUID, std::string> onlineList;
GMLIB_Level::getLevel()->forEachPlayer([&onlineList](Player& pl) -> bool {
ll::service::getLevel()->forEachPlayer([&onlineList](Player& pl) -> bool {
if (!pl.isSimulated()) {
onlineList[pl.getUuid()] = pl.getRealName();
}
@@ -66,25 +116,31 @@ void checkOnlineForm(Player& pl) {
}
std::string getNameFormUuid(mce::UUID const& uuid) {
auto player = GMLIB_Level::getLevel()->getPlayer(uuid);
auto player = ll::service::getLevel()->getPlayer(uuid);
std::string name;
if (player) {
name = player->getRealName();
} else {
auto cache = GMLIB::UserCache::getNameByUuid(uuid);
name = cache ? cache.value() : uuid.asString();
auto cache = ll::service::PlayerInfo::getInstance().fromUuid(uuid);
name = cache ? cache->name : uuid.asString();
}
return name;
}
std::unordered_map<mce::UUID, std::string> generateUuidMap() {
auto allUuids = GMLIB_Player::getAllUuids();
std::unordered_map<mce::UUID, std::string> allList;
for (auto& uuid : allUuids) {
auto name = getNameFormUuid(uuid);
allList[uuid] = name;
}
return std::move(allList);
std::vector<mce::UUID> allUuids;
for (const auto& entry : ll::service::PlayerInfo::getInstance().entries()) {
allUuids.push_back(entry.uuid);
}
for (const auto& player : ll::service::getLevel()->getPlayerList()) {
allUuids.push_back(player.first);
}
std::unordered_map<mce::UUID, std::string> allList;
for (auto& uuid : allUuids) {
auto name = getNameFormUuid(uuid);
allList[uuid] = name;
}
return std::move(allList);
}
void checkAllForm(Player& pl) {
@@ -175,19 +231,41 @@ void searchNotFoundForm(Player& pl, std::string const& name) {
return mainForm(pl);
});
}
/**
* @brief get the playerNBT conveninetly
*/
std::unique_ptr<CompoundTag> getNBTptr(mce::UUID uuid) {
if (auto player = ll::service::getLevel()->getPlayer(uuid))
return static_cast<gmlib::GMPlayer&>(*player).getNbt();
auto db = ll::service::getDBStorage();
if (!db) return nullptr;
auto playerTag = db->getCompoundTag(
"player_" + uuid.asString(),
DBHelpers::Category::Player
);
if (!playerTag||!playerTag->contains("ServerId")) return nullptr;
auto nbt =gmlib::OfflinePlayer(uuid, playerTag->at("ServerId")).getNbt();
return nbt ? std::make_unique<CompoundTag>(*nbt) : nullptr;
}
void checkPlayerForm(Player& pl, mce::UUID const& uuid) {
std::string name = getNameFormUuid(uuid);
auto fm = ll::form::SimpleForm(tr("form.checkPlayer.title"), tr("form.checkPlayer.content", {name}));
fm.appendButton(tr("form.checkPlayer.copyInventory"), [uuid, name](Player& pl) {
saveInventory(pl);
auto nbt = GMLIB_Player::getPlayerNbt(uuid);
if (!nbt) {
auto nbt =getNBTptr(uuid);
auto playerNbt=getNBTptr(pl.getUuid());
if ((!nbt)||(!playerNbt)) {
return pl.sendMessage(tr("checkPlayer.copyInventory.failed", {name}));
}
auto& self = static_cast<GMLIB_Player&>(pl);
GMLIB_Player::setPlayerNbtTags(pl.getUuid(), *nbt, {"Offhand", "Inventory", "Armor", "EnderChestInventory"});
return pl.sendMessage(tr("checkPlayer.copyInventory.success", {name}));
for (auto key : InvKey)
playerNbt->mTags[key] = nbt->at(key);
bool success= validSetNbt(pl.getUuid(), std::move(playerNbt));
pl.refreshInventory();
return pl.sendMessage(tr(success ? "checkPlayer.copyInventory.success" :
"checkPlayer.copyInventory.setFailed",{name}));
});
fm.appendButton(tr("form.checkPlayer.writeInventory"), [uuid, name](Player& pl) {
return confirmWriteForm(pl, uuid, name);
@@ -226,14 +304,18 @@ void confirmWriteForm(Player& pl, mce::UUID const& uuid, std::string const& name
);
fm.sendTo(pl, [uuid, name](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
if (result == ll::form::ModalFormSelectedButton::Upper) {
auto& self = static_cast<GMLIB_Player&>(pl);
auto& self = static_cast<gmlib::GMPlayer&>(pl);
auto nbt = self.getNbt();
auto targetNbt = GMLIB_Player::getPlayerNbt(uuid);
auto targetNbt = getNBTptr(uuid);
if (!targetNbt) {
return pl.sendMessage(tr("checkPlayer.writeInventory.failed", {name}));
}
GMLIB_Player::setPlayerNbtTags(uuid, *nbt, {"Offhand", "Inventory", "Armor", "EnderChestInventory"});
return pl.sendMessage(tr("checkPlayer.writeInventory.success", {name}));
for (auto key : InvKey)
targetNbt->mTags[key] = nbt->at(key);
bool success= validSetNbt(uuid, std::move(targetNbt));
pl.refreshInventory();
return pl.sendMessage(tr(success ? "checkPlayer.writeInventory.success" :
"checkPlayer.writeInventory.setFailed",{name}));
}
return checkPlayerForm(pl, uuid);
});
@@ -248,10 +330,10 @@ void confirmDeleteForm(Player& pl, mce::UUID const& uuid, std::string const& nam
);
fm.sendTo(pl, [uuid, name](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
if (result == ll::form::ModalFormSelectedButton::Upper) {
if (auto player = GMLIB_Level::getLevel()->getPlayer(uuid)) {
if (auto player = ll::service::getLevel()->getPlayer(uuid)) {
return deleteFailedForm(pl, uuid, name);
}
GMLIB_Player::deletePlayer(uuid);
gmlib::OfflinePlayer::deletePlayerNbt(uuid);
return pl.sendMessage(tr("checkPlayer.deletePlayer.success", {name}));
}
return checkPlayerForm(pl, uuid);
+5 -1
View File
@@ -33,12 +33,14 @@ std::string en_US = R"(
command.inventorycheck.desc=Check player inventory.
checkPlayer.copyInventory.success=Successfully copied player %s's inventory to yours!
checkPlayer.copyInventory.failed=It is not possible to copy player %s's backpack to yours! \nPlayer %s doesn't have any data!
checkPlayer.copyInventory.setFailed=CANNOT to copy player %s's backpack to yours!
form.confirmWrite.title=Confirm Action
form.confirmWrite.content=Are you sure you want to cover player %s's backpack with your backpack? \n\nAttention! \nThis operation is irreversible!
form.confirmAction=Confirm
form.cancelAction=Cancel
checkPlayer.writeInventory.success=Successfully overwrote player %s's backpack!
checkPlayer.writeInventory.failed=Cannot cover player %s's backpack! nPlayer %s doesn't have any data!
checkPlayer.writeInventory.failed=Cannot cover player %s's backpack! \nPlayer %s doesn't have any data!
checkPlayer.writeInventory.setFailed=Cannot cover player %s's backpack!
form.confirmDelete.title=Confirm Delete Data
form.confirmDelete.content=Are you sure you want to delete all of player %s's data? \nThis contains all the player's data in the save! \nIt's not just a backpack! \n\nAttention! nThis operation is irreversible! \nPlease proceed with caution
checkPlayer.deletePlayer.success=Successfully deleted player from storage!
@@ -85,12 +87,14 @@ std::string zh_CN = R"(
command.inventorycheck.desc=
checkPlayer.copyInventory.success= %s
checkPlayer.copyInventory.failed= %s \n玩家 %s
checkPlayer.copyInventory.setFailed= %s
form.confirmWrite.title=
form.confirmWrite.content= %s \n\n注意\n此操作不可逆
form.confirmAction=
form.cancelAction=
checkPlayer.writeInventory.success= %s
checkPlayer.writeInventory.failed= %s \n玩家 %s
checkPlayer.writeInventory.setFailed= %s
form.confirmDelete.title=
form.confirmDelete.content= %s \n这包含玩家在存档的全部数据\n不仅仅是背包\n\n注意\n此操作不可逆\n请谨慎操作
checkPlayer.deletePlayer.success= %s
+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
+30 -16
View File
@@ -1,29 +1,43 @@
{
"format_version": 2,
"format_version": 3,
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
"tooth": "github.com/GroupMountain/InventoryCheck",
"version": "0.13.0",
"version": "0.16.0",
"info": {
"name": "InventoryCheck",
"description": "Check Player's Inventory",
"author": "GroupMountain",
"source": "github.com/GroupMountain/InventoryCheck",
"tags": [
"levilamina",
"inventory",
"platform:levilamina",
"type:mod",
"checkbag",
"gmlib"
]
},
"asset_url": "https://github.com/GroupMountain/InventoryCheck/releases/download/v0.13.0/InventoryCheck-windows-x64.zip",
"dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.13.0"
},
"files": {
"place": [
{
"src": "InventoryCheck/*",
"dest": "plugins/InventoryCheck"
}
]
}
"variants": [
{
"platform": "win-x64",
"dependencies": {
"github.com/GroupMountain/GMLIB-Release": ">=26.10.0"
},
"assets": [
{
"type": "self",
"urls": [],
"placements": [
{
"type": "dir",
"src": "InventoryCheck/*",
"dest": "plugins/InventoryCheck"
}
]
}
],
"remove_files": [
"plugins/InventoryCheck"
]
}
]
}
+14 -69
View File
@@ -2,80 +2,25 @@ add_rules("mode.debug", "mode.release")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
add_requires("levilamina 26.10.5", {configs = {target_type = "server"}})
add_requires("levibuildscript")
add_requires("gmlib 26.10.0")
if not has_config("vs_runtime") then
set_runtimes("MD")
end
-- Option 1: Use the latest version of LeviLamina released on GitHub.
add_requires("levilamina")
add_requires("gmlib")
-- Option 2: Use a specific version of LeviLamina released on GitHub.
-- add_requires("levilamina x.x.x")
-- Option 3: Use the latest commit of LeviLamina on GitHub.
-- -- Here, "develop" is the branch name. You can change it to any branch name you want.
-- add_requires("levilamina develop")
-- -- You can also use debug build of LeviLamina.
-- -- add_requires("levilamina develop", {debug = true})
-- package("levilamina")
-- add_urls("https://github.com/LiteLDev/LeviLamina.git")
-- add_deps("ctre 3.8.1")
-- add_deps("entt 3.12.2")
-- add_deps("fmt 10.1.1")
-- add_deps("gsl 4.0.0")
-- add_deps("leveldb 1.23")
-- add_deps("magic_enum 0.9.0")
-- add_deps("nlohmann_json 3.11.2")
-- add_deps("rapidjson 1.1.0")
-- add_deps("pcg_cpp 1.0.0")
-- add_deps("pfr 2.1.1")
-- add_deps("preloader 1.4.0")
-- add_deps("symbolprovider 1.1.0")
-- -- You may need to change this to the target BDS version of your choice.
-- add_deps("bdslibrary 1.20.50.03")
-- on_install(function (package)
-- import("package.tools.xmake").install(package)
-- end)
target("InventoryCheck") -- Change this to your plugin name.
add_cxflags(
"/EHa",
"/utf-8"
)
add_defines(
"NOMINMAX",
"UNICODE"
)
add_files(
"src/**.cpp"
)
add_includedirs(
"src"
)
add_packages(
"levilamina",
"gmlib"
)
add_shflags(
"/DELAYLOAD:bedrock_server.dll" -- Magic to import symbols from BDS
)
set_exceptions("none") -- To avoid conflicts with /EHa
target("InventoryCheck")
add_rules("@levibuildscript/linkrule")
add_rules("@levibuildscript/modpacker")
add_cxflags( "/EHa", "/utf-8", "/W4", "/w44265", "/w44289", "/w44296", "/w45263", "/w44738", "/w45204")
add_defines("NOMINMAX", "UNICODE")
add_packages("levilamina","gmlib")
set_exceptions("none") -- To avoid conflicts with /EHa.
set_kind("shared")
set_languages("c++23")
set_symbols("debug")
after_build(function (target)
local plugin_packer = import("scripts.after_build")
local plugin_define = {
pluginName = target:name(),
pluginFile = path.filename(target:targetfile()),
}
plugin_packer.pack_plugin(target,plugin_define)
end)
add_headerfiles("src/**.h")
add_files("src/**.cpp")
add_includedirs("src")