LeviLamina
Loading...
Searching...
No Matches
CommandOutput.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/server/commands/CommandOutputMessage.h"
5#include "mc/server/commands/CommandOutputParameter.h"
6#include "mc/server/commands/CommandPropertyBag.h"
7
8// auto generated inclusion list
9#include "mc/server/commands/CommandOutputMessageType.h"
10#include "mc/server/commands/CommandOutputType.h"
11
12// auto generated forward declare list
13// clang-format off
14class Actor;
18// clang-format on
19
20class CommandOutput {
21public:
22 // member variables
23 // NOLINTBEGIN
24 CommandOutputType mType;
25 std::unique_ptr<CommandPropertyBag> mBag;
26 std::vector<CommandOutputMessage> mMessages;
27 uint mSuccessCount;
28 bool mHasPlayerText;
29 // NOLINTEND
30
31public:
32 void error(std::string_view msgId, std::vector<::CommandOutputParameter> const& params = {}) {
33 addMessage(msgId, params, CommandOutputMessageType::Error);
34 }
35
36 template <class First, class... Args>
37 requires(!std::is_same_v<std::remove_cvref_t<First>, std::vector<class CommandOutputParameter>>)
38 void success(fmt::format_string<First, Args...> fmt, First&& _args, Args&&... args) {
39 success(fmt::vformat(fmt.get(), fmt::make_format_args(_args, args...)));
40 }
41
42 template <class First, class... Args>
43 requires(!std::is_same_v<std::remove_cvref_t<First>, std::vector<class CommandOutputParameter>>)
44 void error(fmt::format_string<First, Args...> fmt, First&& _args, Args&&... args) {
45 error(fmt::vformat(fmt.get(), fmt::make_format_args(_args, args...)));
46 }
47
48 CommandOutput() {
49 mType = CommandOutputType::None;
50 mBag = {};
51 mMessages = {};
52 mSuccessCount = 0;
53 mHasPlayerText = false;
54 }
55
56public:
57 // member functions
58 // NOLINTBEGIN
59 MCAPI CommandOutput(::CommandOutput const& rhs);
60
61 MCAPI explicit CommandOutput(::CommandOutputType type);
62
63 MCAPI void addMessage(
64 ::std::string_view msgId,
65 ::std::vector<::CommandOutputParameter> const& params,
66 ::CommandOutputMessageType type
67 );
68
69#ifdef LL_PLAT_S
70 MCAPI void addToResultList(::std::string const& key, ::std::string const& element);
71#endif
72
73 MCAPI void addToResultList(::std::string const& key, ::Actor const& element);
74
75 MCAPI ::CommandOutput& operator=(::CommandOutput const& rhs);
76
77 MCAPI void success(::std::string_view msgId, ::std::vector<::CommandOutputParameter> const& params = {});
78 // NOLINTEND
79
80public:
81 // static functions
82 // NOLINTBEGIN
83 MCAPI static void _mDataSetter(::CommandOutput& payload, ::std::optional<::std::string> jsonString);
84 // NOLINTEND
85
86public:
87 // constructor thunks
88 // NOLINTBEGIN
89 MCAPI void* $ctor(::CommandOutput const& rhs);
90
91 MCAPI void* $ctor(::CommandOutputType type);
92 // NOLINTEND
93};
Definition Actor.h:114
Definition CommandOutputMessage.h:8
Definition CommandOutputParameter.h:14
Definition CommandPropertyBag.h:14