Compare commits
9 Commits
@@ -29,4 +29,10 @@ jobs:
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||
path: |
|
||||
bin/
|
||||
bin/DLL/
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: PDB
|
||||
path: |
|
||||
bin/PDB/
|
||||
|
||||
@@ -29,7 +29,13 @@ jobs:
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||
path: |
|
||||
bin/
|
||||
bin/DLL/
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: PDB
|
||||
path: |
|
||||
bin/PDB/
|
||||
|
||||
upload-to-release:
|
||||
needs:
|
||||
@@ -38,24 +44,35 @@ jobs:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- name: Download Plugin
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||
path: release/
|
||||
path: release/Plugin/
|
||||
|
||||
- run: |
|
||||
cp LICENSE README.md release/
|
||||
- name: Download PDB
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: PDB
|
||||
path: release/PDB/
|
||||
|
||||
- name: Copy additional files
|
||||
run: |
|
||||
cp LICENSE README.md release/Plugin/
|
||||
|
||||
- name: Archive release
|
||||
run: |
|
||||
cd release
|
||||
cd release/Plugin
|
||||
zip -r ../${{ github.event.repository.name }}-windows-x64.zip *
|
||||
cd ..
|
||||
|
||||
- uses: softprops/action-gh-release@v1
|
||||
- name: Create GitHub Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
append_body: true
|
||||
files: |
|
||||
${{ github.event.repository.name }}-windows-x64.zip
|
||||
release/${{ github.event.repository.name }}-windows-x64.zip
|
||||
release/PDB/${{ github.event.repository.name }}.pdb
|
||||
|
||||
+1
-1
Submodule SDK-GMLIB updated: fa3ec71bdc...cecc827900
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"name": "${pluginName}",
|
||||
"entry": "${pluginFile}",
|
||||
"version": "0.11.0",
|
||||
"author": "GroupMountain",
|
||||
"description": "Check Player's Inventory",
|
||||
"type": "native",
|
||||
"dependencies": [
|
||||
{
|
||||
|
||||
@@ -88,10 +88,11 @@ function pack_plugin(target,plugin_define)
|
||||
local manifest_path = find_file("manifest.json", os.projectdir())
|
||||
if manifest_path then
|
||||
local manifest = io.readfile(manifest_path)
|
||||
local bindir = path.join(os.projectdir(), "bin")
|
||||
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(outputdir, path.basename(plugin_define.pluginFile) .. ".pdb")
|
||||
local pdbfile = path.join(pdbdir, path.basename(plugin_define.pluginFile) .. ".pdb")
|
||||
local manifestfile = path.join(outputdir, "manifest.json")
|
||||
local oritargetfile = target:targetfile()
|
||||
local oripdbfile = path.join(path.directory(oritargetfile), path.basename(oritargetfile) .. ".pdb")
|
||||
|
||||
@@ -24,6 +24,14 @@ auto enable(ll::plugin::NativePlugin& /*self*/) -> bool {
|
||||
auto load(ll::plugin::NativePlugin& self) -> bool {
|
||||
selfPluginInstance = std::make_unique<std::reference_wrapper<ll::plugin::NativePlugin>>(self);
|
||||
initPlugin();
|
||||
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;
|
||||
}
|
||||
initPlayerDataCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include <include_all.h>
|
||||
|
||||
#define PLUGIN_NAME "InventoryCheck"
|
||||
#define PLUGIN_NAME "InventoryCheck"
|
||||
#define TARGET_PROTOCOL 662
|
||||
|
||||
extern ll::Logger logger;
|
||||
|
||||
|
||||
+22
-24
@@ -74,7 +74,7 @@ void checkOnlineForm(Player& pl) {
|
||||
if (onlineList.size() == 1) {
|
||||
return pl.sendMessage(tr("checkOnline.empty"));
|
||||
}
|
||||
fm.sendTo(pl, [](Player& pl, int index) {
|
||||
fm.sendTo(pl, [](Player& pl, int index, ll::form::FormCancelReason) {
|
||||
if (index == -1) {
|
||||
return mainForm(pl);
|
||||
}
|
||||
@@ -101,8 +101,7 @@ std::string getNameFormUuid(mce::UUID& uuid) {
|
||||
std::unordered_map<mce::UUID, std::string> generateUuidMap() {
|
||||
auto allUuids = GMLIB_Player::getAllUuids();
|
||||
std::unordered_map<mce::UUID, std::string> allList;
|
||||
for (auto& strUuid : allUuids) {
|
||||
auto uuid = mce::UUID::fromString(strUuid);
|
||||
for (auto& uuid : allUuids) {
|
||||
auto name = getNameFormUuid(uuid);
|
||||
allList[uuid] = name;
|
||||
}
|
||||
@@ -120,7 +119,7 @@ void checkAllForm(Player& pl) {
|
||||
if (allList.size() == 1) {
|
||||
return pl.sendMessage(tr("checkAll.empty"));
|
||||
}
|
||||
fm.sendTo(pl, [](Player& pl, int index) {
|
||||
fm.sendTo(pl, [](Player& pl, int index, ll::form::FormCancelReason) {
|
||||
if (index == -1) {
|
||||
return mainForm(pl);
|
||||
}
|
||||
@@ -137,15 +136,15 @@ void searchPlayerForm(Player& pl) {
|
||||
{tr("form.searchPlayer.fuzzySearch"), tr("form.searchPlayer.preciseSearch")},
|
||||
0
|
||||
);
|
||||
fm.sendTo(pl, [](Player& pl, const ll::form::CustomFormResult& result) {
|
||||
if (result.empty()) {
|
||||
fm.sendTo(pl, [](Player& pl, ll::form::CustomFormResult const& result, ll::form::FormCancelReason) {
|
||||
if (!result.has_value()) {
|
||||
return mainForm(pl);
|
||||
}
|
||||
std::string inputName;
|
||||
if (std::holds_alternative<std::string>(result.at("name"))) {
|
||||
inputName = std::get<std::string>(result.at("name"));
|
||||
if (std::holds_alternative<std::string>(result->at("name"))) {
|
||||
inputName = std::get<std::string>(result->at("name"));
|
||||
}
|
||||
auto searchMode = std::get<std::string>(result.at("mode"));
|
||||
auto searchMode = std::get<std::string>(result->at("mode"));
|
||||
if (inputName.empty()) {
|
||||
return invalidInputForm(pl);
|
||||
}
|
||||
@@ -174,9 +173,9 @@ void searchPlayerForm(Player& pl) {
|
||||
void searchResultForm(Player& pl, std::unordered_map<mce::UUID, std::string> resultList) {
|
||||
auto fm = ll::form::SimpleForm(tr("form.checkList.title"), tr("form.checkList.content"));
|
||||
for (auto& [uuid, name] : resultList) {
|
||||
fm.appendButton(name, [&uuid](Player& pl) { checkPlayerForm(pl, uuid); });
|
||||
fm.appendButton(name, [uuid](Player& pl) { checkPlayerForm(pl, uuid); });
|
||||
}
|
||||
fm.sendTo(pl, [](Player& pl, int index) {
|
||||
fm.sendTo(pl, [](Player& pl, int index, ll::form::FormCancelReason) {
|
||||
if (index == -1) {
|
||||
return searchPlayerForm(pl);
|
||||
}
|
||||
@@ -190,8 +189,8 @@ void searchNotFoundForm(Player& pl, std::string& name) {
|
||||
tr("form.notFound.returnSearch"),
|
||||
tr("form.returnMainForm")
|
||||
);
|
||||
fm.sendTo(pl, [](Player& pl, ll::form::ModalForm::SelectedButton result) {
|
||||
if (result == ll::form::ModalForm::SelectedButton::Upper) {
|
||||
fm.sendTo(pl, [](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
|
||||
if (result == ll::form::ModalFormSelectedButton::Upper) {
|
||||
return searchPlayerForm(pl);
|
||||
}
|
||||
return mainForm(pl);
|
||||
@@ -217,7 +216,7 @@ void checkPlayerForm(Player& pl, mce::UUID uuid) {
|
||||
fm.appendButton(tr("form.checkPlayer.deleteData"), [uuid, name](Player& pl) {
|
||||
return confirmDeleteForm(pl, uuid, name);
|
||||
});
|
||||
fm.sendTo(pl, [](Player& pl, int index) {
|
||||
fm.sendTo(pl, [](Player& pl, int index, ll::form::FormCancelReason) {
|
||||
if (index == -1) {
|
||||
return mainForm(pl);
|
||||
}
|
||||
@@ -231,8 +230,8 @@ void invalidInputForm(Player& pl) {
|
||||
tr("form.invalidInput.returnSearch"),
|
||||
tr("form.returnMainForm")
|
||||
);
|
||||
fm.sendTo(pl, [](Player& pl, ll::form::ModalForm::SelectedButton result) {
|
||||
if (result == ll::form::ModalForm::SelectedButton::Upper) {
|
||||
fm.sendTo(pl, [](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
|
||||
if (result == ll::form::ModalFormSelectedButton::Upper) {
|
||||
return searchPlayerForm(pl);
|
||||
}
|
||||
return mainForm(pl);
|
||||
@@ -246,8 +245,8 @@ void confirmWriteForm(Player& pl, mce::UUID uuid, std::string name) {
|
||||
tr("form.confirmAction"),
|
||||
tr("form.cancelAction")
|
||||
);
|
||||
fm.sendTo(pl, [uuid, name](Player& pl, ll::form::ModalForm::SelectedButton result) {
|
||||
if (result == ll::form::ModalForm::SelectedButton::Upper) {
|
||||
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 nbt = self.getNbt();
|
||||
auto targetNbt = GMLIB_Player::getPlayerNbt(uuid);
|
||||
@@ -268,14 +267,13 @@ void confirmDeleteForm(Player& pl, mce::UUID uuid, std::string name) {
|
||||
tr("form.confirmAction"),
|
||||
tr("form.cancelAction")
|
||||
);
|
||||
fm.sendTo(pl, [uuid, name](Player& pl, ll::form::ModalForm::SelectedButton result) {
|
||||
if (result == ll::form::ModalForm::SelectedButton::Upper) {
|
||||
fm.sendTo(pl, [uuid, name](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
|
||||
if (result == ll::form::ModalFormSelectedButton::Upper) {
|
||||
auto player = GMLIB_Level::getLevel()->getPlayer(uuid);
|
||||
if (player) {
|
||||
return deleteFailedForm(pl, uuid, name);
|
||||
}
|
||||
auto serverId = GMLIB_Player::getServerIdFromUuid(uuid);
|
||||
GMLIB_Player::deletePlayerNbt(serverId);
|
||||
GMLIB_Player::deletePlayerNbt(uuid);
|
||||
return pl.sendMessage(tr("checkPlayer.deleteNbt.success", {name}));
|
||||
}
|
||||
return checkPlayerForm(pl, uuid);
|
||||
@@ -289,8 +287,8 @@ void deleteFailedForm(Player& pl, mce::UUID uuid, std::string name) {
|
||||
tr("form.deleteFailed.returnCheck"),
|
||||
tr("form.returnMainForm")
|
||||
);
|
||||
fm.sendTo(pl, [uuid](Player& pl, ll::form::ModalForm::SelectedButton result) {
|
||||
if (result == ll::form::ModalForm::SelectedButton::Upper) {
|
||||
fm.sendTo(pl, [uuid](Player& pl, ll::form::ModalFormResult result, ll::form::FormCancelReason) {
|
||||
if (result == ll::form::ModalFormSelectedButton::Upper) {
|
||||
return checkPlayerForm(pl, uuid);
|
||||
}
|
||||
return mainForm(pl);
|
||||
|
||||
@@ -49,6 +49,8 @@ std::string defaultLanguage_en_US = R"(
|
||||
checkAll.empty=You've played the entire archive alone, and you're still playing here to check the bag? \nWhy don't you go and recruit people?
|
||||
resumeInventory.success=Your backpack has been resumed!
|
||||
resumeInventory.failed=Unable to resume your backpack, no data was found on your backpack!
|
||||
error.protocolMismatch.info=You are running on an unsupport protocol version! This may result in crash!
|
||||
error.protocolMismatch.version=Support protocol %1$s, current protocol %2$s.
|
||||
)";
|
||||
|
||||
std::string defaultLanguage_zh_CN = R"(
|
||||
@@ -99,4 +101,6 @@ std::string defaultLanguage_zh_CN = R"(
|
||||
checkAll.empty=整个存档就你一个人玩过,还在这玩查包呢?\n还不快去招人?
|
||||
resumeInventory.success=已成功复原你的背包!
|
||||
resumeInventory.failed=无法复原你的背包,没有找到你的背包数据!
|
||||
error.protocolMismatch.info=此插件正在不兼容的版本协议上运行!这可能造成服务器崩溃!
|
||||
error.protocolMismatch.version=此插件支持版本协议 %1$s,服务器版本协议 %2$s。
|
||||
)";
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": 2,
|
||||
"tooth": "github.com/GroupMountain/InventoryCheck",
|
||||
"version": "0.9.0",
|
||||
"version": "0.11.0",
|
||||
"info": {
|
||||
"name": "InventoryCheck",
|
||||
"description": "Check Player's Inventory",
|
||||
@@ -14,9 +14,9 @@
|
||||
"gmlib"
|
||||
]
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/InventoryCheck/releases/download/v0.9.0/InventoryCheck-windows-x64.zip",
|
||||
"asset_url": "https://github.com/GroupMountain/InventoryCheck/releases/download/v0.11.0/InventoryCheck-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.9.0"
|
||||
"github.com/GroupMountain/GMLIB": ">=0.10.0"
|
||||
},
|
||||
"files": {
|
||||
"place": [
|
||||
|
||||
Reference in New Issue
Block a user