LeviLamina
Loading...
Searching...
No Matches
CustomCommandRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/scripting/runtime/Result.h"
7#include "mc/deps/scripting/script_engine/ClosureGeneric.h"
8#include "mc/scripting/modules/minecraft/ScriptServerStateMonitor.h"
9#include "mc/scripting/modules/minecraft/commands/ScriptCustomCommandInterface.h"
10
11// auto generated forward declare list
12// clang-format off
13class CommandRegistry;
15namespace ScriptModuleMinecraft { class CommandClosureStorage; }
16namespace ScriptModuleMinecraft { struct ScriptCustomCommandError; }
17namespace ScriptModuleMinecraft { struct ScriptCustomCommandResult; }
18namespace ScriptModuleMinecraft { struct ScriptNamespaceNameError; }
19namespace Scripting { struct EngineError; }
20// clang-format on
21
22namespace ScriptModuleMinecraft {
23
24class CustomCommandRegistry : public ::ScriptModuleMinecraft::ScriptServerStateMonitor {
25public:
26 // CustomCommandRegistry inner types declare
27 // clang-format off
29 // clang-format on
30
31 // CustomCommandRegistry inner types define
33 public:
34 // PendingRegistrations inner types declare
35 // clang-format off
36 struct CommandData;
37 // clang-format on
38
39 // PendingRegistrations inner types define
40 struct CommandData {
41 public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 40, ::std::optional<::std::string>> mAliasOpt;
45 ::ll::TypedStorage<8, 136, ::ScriptModuleMinecraft::ScriptCustomCommandInterface> mCommandInterface;
46 ::ll::TypedStorage<
47 8,
48 104,
50 mClosure;
51 // NOLINTEND
52
53 public:
54 // member functions
55 // NOLINTBEGIN
56 MCAPI ~CommandData();
57 // NOLINTEND
58
59 public:
60 // destructor thunk
61 // NOLINTBEGIN
62 MCAPI void $dtor();
63 // NOLINTEND
64 };
65
66 using CommandMap = ::std::unordered_map<
67 ::std::string,
69
70 using EnumNameValuesMap = ::std::unordered_map<::std::string, ::std::vector<::std::string>>;
71
72 using EnumValues = ::std::vector<::std::string>;
73
74 public:
75 // member variables
76 // NOLINTBEGIN
77 ::ll::TypedStorage<8, 32, ::std::string> mNamespace;
78 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::vector<::std::string>>> mEnums;
79 ::ll::TypedStorage<
80 8,
81 64,
82 ::std::unordered_map<
83 ::std::string,
85 mCommands;
86 // NOLINTEND
87
88 public:
89 // member functions
90 // NOLINTBEGIN
92 // NOLINTEND
93
94 public:
95 // destructor thunk
96 // NOLINTBEGIN
97 MCAPI void $dtor();
98 // NOLINTEND
99 };
100
101public:
102 // member variables
103 // NOLINTBEGIN
104 ::ll::TypedStorage<8, 8, ::CommandRegistry&> mCommandRegistry;
105 ::ll::TypedStorage<
106 8,
107 64,
108 ::std::unordered_map<::std::string, ::ScriptModuleMinecraft::CustomCommandRegistry::PendingRegistrations>>
109 mPendingRegistrationsByPack;
110 ::ll::TypedStorage<
111 8,
112 64,
113 ::std::unordered_map<::std::string, ::std::shared_ptr<::ScriptModuleMinecraft::CommandClosureStorage>>>
114 mRegisteredClosures;
115 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::std::string>>> mEnumNameStorage;
116 ::ll::TypedStorage<8, 64, ::std::unordered_set<::std::string>> mClaimedAliases;
117 // NOLINTEND
118
119public:
120 // prevent constructor by default
121 CustomCommandRegistry& operator=(CustomCommandRegistry const&);
122 CustomCommandRegistry(CustomCommandRegistry const&);
123 CustomCommandRegistry();
124
125public:
126 // virtual functions
127 // NOLINTBEGIN
128 virtual ~CustomCommandRegistry() /*override*/;
129
130 virtual void _onScriptInitializationComplete() /*override*/;
131 // NOLINTEND
132
133public:
134 // member functions
135 // NOLINTBEGIN
136 MCAPI CustomCommandRegistry(::ServerScriptManagerEvents& events, ::CommandRegistry& commandRegistry);
137
138 MCAPI ::std::optional<::ScriptModuleMinecraft::ScriptCustomCommandError> _checkNamespaceConsistency(
140 ::std::string_view newNamespace
141 ) const;
142
143 MCAPI ::ScriptModuleMinecraft::CustomCommandRegistry::PendingRegistrations&
144 _getOrCreatePendingRegistrationsForPack(::std::string const& packUUID, ::std::string_view newNamespace);
145
146 MCAPI void _processRegistrations();
147
148 MCAPI void _reloadRegistrations();
149
150 MCAPI ::std::optional<::std::string> _tryClaimAlias(::std::string const& commandName);
151
152 MCAPI ::std::optional<::std::string> _validateEnumDependencies(
155 ) const;
156
157 MCAPI ::Scripting::Result<
158 void,
162 addPendingCommand(
163 ::std::string const& packUUID,
165 ::Scripting::ClosureGeneric<::std::optional<::ScriptModuleMinecraft::ScriptCustomCommandResult>>&& closure
166 );
167
168 MCAPI ::Scripting::Result<
169 void,
173 addPendingEnum(
174 ::std::string const& packUUID,
175 ::std::string const& name,
176 ::std::vector<::std::string> const& values
177 );
178 // NOLINTEND
179
180public:
181 // constructor thunks
182 // NOLINTBEGIN
183 MCAPI void* $ctor(::ServerScriptManagerEvents& events, ::CommandRegistry& commandRegistry);
184 // NOLINTEND
185
186public:
187 // destructor thunk
188 // NOLINTBEGIN
189 MCAPI void $dtor();
190 // NOLINTEND
191
192public:
193 // virtual function thunks
194 // NOLINTBEGIN
195 MCAPI void $_onScriptInitializationComplete();
196
197
198 // NOLINTEND
199
200public:
201 // vftables
202 // NOLINTBEGIN
203 MCNAPI static void** $vftable();
204 // NOLINTEND
205};
206
207} // namespace ScriptModuleMinecraft
Definition CommandRegistry.h:47
Definition CommandClosureStorage.h:16
Definition ScriptServerStateMonitor.h:16
Definition ClosureGeneric.h:8
Definition ScriptCustomCommandError.h:16
Definition ScriptCustomCommandInterface.h:16
Definition ScriptCustomCommandResult.h:15
Definition ScriptNamespaceNameError.h:18
Definition EngineError.h:15
Definition ServerScriptManagerEvents.h:13