35 std::unique_ptr<Impl> impl;
39 void disableModCommands(std::string_view modName);
51 std::string
const& name,
52 std::string
const& description = {},
53 CommandPermissionLevel requirement = CommandPermissionLevel::Any,
55 std::weak_ptr<mod::Mod> mod = mod::NativeMod::current()
58 LLAPI
bool hasEnum(std::string
const& name);
60 LLAPI
bool tryRegisterEnum(
61 std::string
const& name,
62 std::vector<std::pair<std::string, uint64>> values,
64 CommandRegistry::ParseFunction parser
66 LLAPI
bool addEnumValues(
67 std::string
const& name,
68 std::vector<std::pair<std::string, uint64>> values,
72 LLAPI
bool tryRegisterRuntimeEnum(std::string
const& name, std::vector<std::pair<std::string, uint64>> values);
73 LLAPI
bool addRuntimeEnumValues(std::string
const& name, std::vector<std::pair<std::string, uint64>> values);
75 LLAPI
bool hasSoftEnum(std::string
const& name);
77 LLAPI
bool tryRegisterSoftEnum(std::string
const& name, std::vector<std::string> values);
79 LLAPI
bool addSoftEnumValues(std::string
const& name, std::vector<std::string> values);
81 LLAPI
bool removeSoftEnumValues(std::string
const& name, std::vector<std::string> values);
83 LLAPI
bool setSoftEnumValues(std::string
const& name, std::vector<std::string> values);
85 template <concepts::Require<std::is_enum> T>
86 inline bool tryRegisterEnum() {
87 static std::vector<std::pair<std::string, uint64>> values{[] {
88 std::vector<std::pair<std::string, uint64>> vals;
89 if constexpr (magic_enum::enum_count<T>() > 0) {
90 magic_enum::enum_for_each<T>([&](T enumVal) {
91 vals.emplace_back(magic_enum::enum_name(enumVal), (uint64)enumVal);
96 return tryRegisterEnum(::ll::command::enum_name_v<T>, values, Bedrock::type_id<CommandRegistry, T>(), &CommandRegistry::parse<T>);
98 template <concepts::Require<std::is_enum> T>
99 inline bool tryRegisterRuntimeEnum() {
100 static std::vector<std::pair<std::string, uint64>> values{[] {
101 std::vector<std::pair<std::string, uint64>> vals;
102 if constexpr (magic_enum::enum_count<T>() > 0) {
103 magic_enum::enum_for_each<T>([&](T enumVal) {
104 vals.emplace_back(magic_enum::enum_name(enumVal), (uint64)enumVal);
109 return tryRegisterRuntimeEnum(::ll::command::enum_name_v<T>, values);
112 template <concepts::Specializes<SoftEnum> T>
113 inline bool tryRegisterSoftEnum() {
114 static std::vector<std::string> values{[] {
115 std::vector<std::string> vals;
116 using enum_type = remove_soft_enum_t<T>;
117 if constexpr (magic_enum::enum_count<enum_type>() > 0) {
118 magic_enum::enum_for_each<enum_type>([&](enum_type enumVal) {
119 vals.emplace_back(magic_enum::enum_name(enumVal));
124 return tryRegisterSoftEnum(::ll::command::enum_name_v<T>, values);