Skip to content

Commit

Permalink
fix: fix tpdim
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Jan 3, 2025
1 parent c897aea commit a6f010b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
6 changes: 2 additions & 4 deletions src/ll/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace ll {

struct LeviConfig {

int version = 30;
int version = 31;

std::string language = "system";
struct {
Expand All @@ -24,9 +24,7 @@ struct LeviConfig {
CommandPermissionLevel permission = CommandPermissionLevel::GameDirectors;
};
struct {
struct {
bool enabled = true;
} tpdimOverload{};
CmdSetting tpdimCommand{};
CmdSetting crashCommand{false};
CmdSetting versionCommand{};
CmdSetting memstatsCommand{true, CommandPermissionLevel::Host};
Expand Down
15 changes: 3 additions & 12 deletions src/ll/core/command/BuiltinCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,19 @@

namespace ll::command {
LL_TYPE_INSTANCE_HOOK(
registerBuiltinCommands,
RegisterBuiltinCommands,
ll::memory::HookPriority::Highest,
ServerInstanceEventCoordinator,
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
void,
::ServerInstance& ins
) {
origin(ins);
registerTpdimCommand();
registerVersionCommand();
registerMemstatsCommand();
registerCrashCommand();
registerModManageCommand();
}
LL_STATIC_HOOK(
registerTpdimCommands,
ll::memory::HookPriority::Normal,
&TeleportCommand::setup,
void,
CommandRegistry& registry
) {
origin(registry);
registerTpdimCommand();
}
void registerCommands() { static memory::HookRegistrar<registerBuiltinCommands, registerTpdimCommands> hooks{}; }
void registerCommands() { static memory::HookRegistrar<RegisterBuiltinCommands> hooks{}; }
} // namespace ll::command
6 changes: 4 additions & 2 deletions src/ll/core/command/Teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ struct TpTarget {
};

void registerTpdimCommand() {
auto config = ll::getLeviConfig().modules.command.tpdimOverload;
auto config = ll::getLeviConfig().modules.command.tpdimCommand;
if (!config.enabled) {
return;
}
auto& cmd = CommandRegistrar::getInstance().getOrCreateCommand("tp");
auto& cmd = CommandRegistrar::getInstance()
.getOrCreateCommand("teleportdim", "commands.tp.description", config.permission)
.alias("tpdim");

cmd.overload<TpSelf>()
.required("destination")
Expand Down

0 comments on commit a6f010b

Please sign in to comment.