Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
Fix LLTpa
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Dec 23, 2021
1 parent d037e20 commit 8d52106
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Support for LiteLoaderBDS 2.0.3
## Bug Fix
- Fix Tpa GUI error
- Fix Warp GUI crash
7 changes: 2 additions & 5 deletions LLtpa/Teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ class TpaCommand : public Command {
sendForm(*ori.getPlayer(), FullFormBinder{fm,{[](ServerPlayer& P, FullFormBinder::DType data) {
if (!data.set) return;
auto& [d1,d2] = data.val();
logger.debug("{} {}", d2[0], d2[1]);
P.runcmd("tpa " + d2[0] + " " + d2[1]);
}} });
break;
Expand All @@ -288,7 +287,7 @@ class TpaCommand : public Command {
using RegisterCommandHelper::makeMandatory;
using RegisterCommandHelper::makeOptional;
registry->registerCommand("tpa", "Teleport", CommandPermissionLevel::Any, { (CommandFlagValue)0 }, { (CommandFlagValue)0x80 });
registry->addEnum<direction>("TPAOP2", { {"to", direction::A_B}, {"from", direction::B_A}});
registry->addEnum<direction>("TPAOP2", { {"to", direction::A_B}, {"here", direction::B_A}});
registry->addEnum<TpaCommand::TPAOP>("TPAOP", { {"ac", TPAOP::ac}, {"de", TPAOP::de}, {"cancel", TPAOP::cancel}, {"gui", TPAOP::gui}, {"toggle", TPAOP::toggle}});
registry->registerOverload<TpaCommand>("tpa", makeMandatory<CommandParameterDataType::ENUM>(&TpaCommand::dir, "direction", "TPAOP2", &TpaCommand::dir_isSet), makeMandatory(&TpaCommand::target, "player"));
registry->registerOverload<TpaCommand>("tpa", makeMandatory<CommandParameterDataType::ENUM>(&TpaCommand::op, "op", "TPAOP", &TpaCommand::tpaop_isSet));
Expand All @@ -311,7 +310,6 @@ void sendWARPGUI(ServerPlayer* wp) {
using namespace GUI;
sendForm(*wp, SimpleFormBinder(WARPGUI, [](ServerPlayer& wp, SimpleFormBinder::DType d) {
if (d.set) {
logger.debug("d.val().second {}", d.val().second);
wp.runcmd("warp go " + d.val().second);
}
}));
Expand Down Expand Up @@ -471,7 +469,6 @@ class HomeCommand : public Command {
}
GUI::sendForm(*wp, GUI::SimpleFormBinder::SimpleFormBinder(HomeGUI, [](ServerPlayer& wp, GUI::SimpleFormBinder::DType d) {
if (d.set) {
logger.debug("d.val().second: {}", d.val().second);
wp.runcmd("home go " + d.val().second);
}
}));
Expand Down Expand Up @@ -560,6 +557,7 @@ void loadall() {
rs.apply(warps);
}
loadCfg();
reinitWARPGUI();
}

void tpa_entry() {
Expand All @@ -569,7 +567,6 @@ void tpa_entry() {
db = KVDB::create("plugins\\LLtpa\\data", true, 8);
Translation::load("plugins/LLtpa/langpack/tpa.json");
loadall();
//reinitWARPGUI();
schTask();
Event::RegCmdEvent::subscribe([](const Event::RegCmdEvent& e) {
if (TPA_ENABLED) TpaCommand::setup(e.mCommandRegistry);
Expand Down

0 comments on commit 8d52106

Please sign in to comment.