35 std::unique_ptr<Impl> impl;
40 void disableModCommands(std::string_view modName);
44 [[nodiscard]] CommandRegistry& getRegistry()
const;
52 std::string
const& name,
53 std::string
const& description = {},
54 CommandPermissionLevel requirement = CommandPermissionLevel::Any,
55 CommandFlag flag = CommandFlagValue::NotCheat,
56 std::weak_ptr<mod::Mod> mod = mod::NativeMod::current()
59 LLAPI
bool hasEnum(std::string
const& name);
61 LLAPI
bool tryRegisterEnum(
62 std::string
const& name,
63 std::vector<std::pair<std::string, uint64>> values,
64 Bedrock::typeid_t<CommandRegistry> type,
65 CommandRegistry::ParseFunction parser
67 LLAPI
bool addEnumValues(
68 std::string
const& name,
69 std::vector<std::pair<std::string, uint64>> values,
70 Bedrock::typeid_t<CommandRegistry> type
73 LLAPI
bool tryRegisterRuntimeEnum(std::string
const& name, std::vector<std::pair<std::string, uint64>> values);
74 LLAPI
bool addRuntimeEnumValues(std::string
const& name, std::vector<std::pair<std::string, uint64>> values);
76 LLAPI
bool hasSoftEnum(std::string
const& name);
78 LLAPI
bool tryRegisterSoftEnum(std::string
const& name, std::vector<std::string> values);
80 LLAPI
bool addSoftEnumValues(std::string
const& name, std::vector<std::string> values);
82 LLAPI
bool removeSoftEnumValues(std::string
const& name, std::vector<std::string> values);
84 LLAPI
bool setSoftEnumValues(std::string
const& name, std::vector<std::string> values);
86 template <concepts::Require<std::is_enum> T>
87 inline bool tryRegisterEnum() {
88 static std::vector<std::pair<std::string, uint64>> values{[] {
89 std::vector<std::pair<std::string, uint64>> vals;
90 if constexpr (magic_enum::enum_count<T>() > 0) {
91 magic_enum::enum_for_each<T>([&](T enumVal) {
92 vals.emplace_back(magic_enum::enum_name(enumVal), (uint64)enumVal);
97 return tryRegisterEnum(
98 ::ll::command::enum_name_v<T>,
100 Bedrock::type_id<CommandRegistry, T>(),
101 &CommandRegistry::parse<T>
104 template <concepts::Require<std::is_enum> T>
105 inline bool tryRegisterRuntimeEnum() {
106 static std::vector<std::pair<std::string, uint64>> values{[] {
107 std::vector<std::pair<std::string, uint64>> vals;
108 if constexpr (magic_enum::enum_count<T>() > 0) {
109 magic_enum::enum_for_each<T>([&](T enumVal) {
110 vals.emplace_back(magic_enum::enum_name(enumVal), (uint64)enumVal);
115 return tryRegisterRuntimeEnum(::ll::command::enum_name_v<T>, values);
118 template <concepts::Specializes<SoftEnum> T>
119 inline bool tryRegisterSoftEnum() {
120 static std::vector<std::string> values{[] {
121 std::vector<std::string> vals;
122 using enum_type = remove_soft_enum_t<T>;
123 if constexpr (magic_enum::enum_count<enum_type>() > 0) {
124 magic_enum::enum_for_each<enum_type>([&](enum_type enumVal) {
125 vals.emplace_back(magic_enum::enum_name(enumVal));
130 return tryRegisterSoftEnum(::ll::command::enum_name_v<T>, values);