Fix 指令在无作弊情况下不能使用

This commit is contained in:
Qiuzhizhe 2023-03-26 06:50:43 -07:00
parent 3159677ba0
commit ac7733eeee
6 changed files with 11 additions and 12 deletions

View File

@ -390,7 +390,7 @@
/*0*/ virtual ~DynamicCommand();
/*1*/ virtual void execute(class CommandOrigin const& origin, class CommandOutput& output) const;
LIAPI static std::unique_ptr<class DynamicCommandInstance> createCommand(std::string const& name, std::string const& description, CommandPermissionLevel permission = CommandPermissionLevel::GameMasters, CommandFlag flag1 = {(CommandFlagValue)0x80}, CommandFlag flag2 = {(CommandFlagValue)0}, HMODULE handle = GetCurrentModule());
LIAPI static std::unique_ptr<class DynamicCommandInstance> createCommand(std::string const& name, std::string const& description, CommandPermissionLevel permission = CommandPermissionLevel::GameMasters, CommandFlag flag1 = {(CommandFlagValue)4}, CommandFlag flag2 = {(CommandFlagValue)0}, HMODULE handle = GetCurrentModule());
LIAPI static std::unique_ptr<class DynamicCommandInstance> createCommand(
std::string const& name,
std::string const& description,
@ -399,7 +399,7 @@
std::vector<std::vector<std::string>>&& overloads,
CallBackFn callback,
CommandPermissionLevel permission = CommandPermissionLevel::GameMasters,
CommandFlag flag1 = {(CommandFlagValue)0x80},
CommandFlag flag1 = {(CommandFlagValue)0x40},
CommandFlag flag2 = {(CommandFlagValue)0},
HMODULE handle = GetCurrentModule());
@ -412,7 +412,7 @@
std::vector<std::vector<std::string>>&& overloads,
CallBackFn callback,
CommandPermissionLevel permission = CommandPermissionLevel::GameMasters,
CommandFlag flag1 = {(CommandFlagValue)0x80},
CommandFlag flag1 = {(CommandFlagValue)0x40},
CommandFlag flag2 = {(CommandFlagValue)0},
HMODULE handle = GetCurrentModule()) {
return setup(createCommand(name, description, std::move(enums), std::move(params), std::move(overloads), std::move(callback), permission, flag1, flag2, handle));
@ -483,7 +483,7 @@
friend class DynamicCommand;
LIAPI DynamicCommandInstance(std::string const& name, std::string const& description, CommandPermissionLevel permission = CommandPermissionLevel::GameMasters, CommandFlag flag = {(CommandFlagValue)0x80}, HMODULE handle = GetCurrentModule());
LIAPI DynamicCommandInstance(std::string const& name, std::string const& description, CommandPermissionLevel permission = CommandPermissionLevel::GameMasters, CommandFlag flag = {(CommandFlagValue)0x40}, HMODULE handle = GetCurrentModule());
LIAPI bool setBuilder(DynamicCommand::BuilderFn builder);
LIAPI DynamicCommand::BuilderFn initCommandBuilder();

View File

@ -514,7 +514,7 @@ public:
static void setup(CommandRegistry* registry) {
registry->registerCommand("addons", "LiteLoaderBDS Addons Helper (Restart required after addon changes)",
CommandPermissionLevel::GameMasters, {(CommandFlagValue)0}, {(CommandFlagValue)0x80});
CommandPermissionLevel::GameMasters, {(CommandFlagValue)0}, {(CommandFlagValue)0x40});
vector<string> addonsList;
for (auto& addon : addons)

View File

@ -118,7 +118,7 @@ public:
static void setup(CommandRegistry* registry) {
registry->registerCommand(
"tpdim", "Teleport to Dimension", CommandPermissionLevel::GameMasters,
{(CommandFlagValue)0}, {(CommandFlagValue)0x80});
{(CommandFlagValue)0}, {(CommandFlagValue)0x40});
registry->addEnum<DimensionType>("DimensionType",
{
{"overworld", DimensionType::OverWorld},
@ -312,7 +312,7 @@ public:
static void setup(CommandRegistry* registry) {
// Register Cmd
registry->registerCommand("ll", "LiteLoaderBDS plugin operations",
CommandPermissionLevel::Console, {(CommandFlagValue)0}, {(CommandFlagValue)0x80});
CommandPermissionLevel::Console, {(CommandFlagValue)0}, {(CommandFlagValue)0x40});
// Register softenum
vector<string> pluginList;
@ -372,7 +372,7 @@ public:
static void setup(CommandRegistry* registry) {
registry->registerCommand("version", "Get the version of this server",
CommandPermissionLevel::GameMasters, {(CommandFlagValue)0}, {(CommandFlagValue)0x80});
CommandPermissionLevel::GameMasters, {(CommandFlagValue)0}, {(CommandFlagValue)0x40});
registry->registerOverload<VersionCommand>("version");
}
};

View File

@ -10,7 +10,7 @@ bool isUnlockCmdEnabled = true;
void LogCommandRegistration(std::string const& name, char const* description, enum CommandPermissionLevel perm, short flag1, short flag2);
TInstanceHook(void, "?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
CommandRegistry, std::string const& name, char const* description, enum CommandPermissionLevel perm, short flag1, short flag2) {
CommandRegistry, std::string const& name, char const* description, enum CommandPermissionLevel perm, unsigned char flag1, unsigned char flag2) {
// For #643
if (name.find(' ') == std::string::npos) { // If no space inside
// Check whether command is already exists before registering
@ -20,7 +20,7 @@ TInstanceHook(void, "?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@D
}
}
if (ll::globalConfig.enableUnlockCmd) {
flag1 |= 0x80;
flag2 |= 0x40;
}
if (ll::globalConfig.debugMode) {
LogCommandRegistration(name, description, perm, flag1, flag2);

View File

@ -19,7 +19,7 @@ using namespace std;
bool RegisterCmd(const string& cmd, const string& describe, int cmdLevel) {
::Global<CommandRegistry>->registerCommand(cmd, describe.c_str(), (CommandPermissionLevel)cmdLevel, {(CommandFlagValue)0},
{(CommandFlagValue)0x80});
{(CommandFlagValue)0x40});
return true;
}

View File

@ -87,7 +87,6 @@ ClassDefine<PlayerClass> PlayerClassBuilder =
.instanceProperty("isAdventure", &PlayerClass::isAdventure)
.instanceProperty("isGliding", &PlayerClass::isGliding)
.instanceProperty("isSurvival", &PlayerClass::isSurvival)
// .instanceProperty("isSpectator", &PlayerClass::isSpectator)
.instanceProperty("isRiding", &PlayerClass::isRiding)
.instanceProperty("isDancing", &PlayerClass::isDancing)
.instanceProperty("isCreative", &PlayerClass::isCreative)