This repository has been archived by the owner on Jan 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "mc/world/actor/player/Player.h" | ||
#include <string> | ||
|
||
namespace tools::api { | ||
|
||
bool runCmd(Player& player, const std::string&); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "api/Global.h" | ||
#include <ll/api/service/Bedrock.h> | ||
#include <ll/api/service/ServerInfo.h> | ||
#include <ll/api/service/Service.h> | ||
#include <ll/api/service/ServiceManager.h> | ||
#include <mc/common/wrapper/optional_ref.h> | ||
#include <mc/server/commands/CommandContext.h> | ||
#include <mc/server/commands/MinecraftCommands.h> | ||
#include <mc/server/commands/PlayerCommandOrigin.h> | ||
#include <mc/world/Minecraft.h> | ||
#include <mc/world/actor/player/Player.h> | ||
#include <mc/world/level/Command.h> | ||
|
||
|
||
namespace tools::api { | ||
|
||
bool runCmd(Player& player, const std::string& cmd) { | ||
try { | ||
CommandContext context = | ||
CommandContext(cmd, std::make_unique<PlayerCommandOrigin>(PlayerCommandOrigin(player))); | ||
ll::service::getMinecraft()->getCommands().executeCommand(context); | ||
return true; | ||
} catch (...) { | ||
return false; | ||
} | ||
} | ||
|
||
|
||
} // namespace tools::api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "mc/world/actor/player/Player.h" | ||
#include <filesystem> | ||
#include <functional> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace tools::form { | ||
|
||
void index(Player&, std::filesystem::path); | ||
void index(Player&); | ||
|
||
extern std::unordered_map<std::string, std::function<void(Player&)>> mapping; | ||
|
||
bool initMapping(); | ||
|
||
} // namespace tools::form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "form/Global.h" | ||
#include "mc/world/actor/player/Player.h" | ||
#include <functional> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace tools::form { | ||
|
||
std::unordered_map<std::string, std::function<void(Player&)>> mapping; | ||
|
||
void test(Player& player) { player.sendMessage("test"); } | ||
|
||
bool initMapping() { | ||
mapping["test"] = test; | ||
return true; | ||
} | ||
|
||
|
||
} // namespace tools::form |