3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/server/commands/CommandAsyncFlag.h"
5#include "mc/server/commands/CommandCheatFlag.h"
6#include "mc/server/commands/CommandEditorFlag.h"
7#include "mc/server/commands/CommandExecuteFlag.h"
8#include "mc/server/commands/CommandSyncFlag.h"
9#include "mc/server/commands/CommandTypeFlag.h"
10#include "mc/server/commands/CommandUsageFlag.h"
11#include "mc/server/commands/CommandVisibilityFlag.h"
14enum class CommandFlagValue : ushort {
17 HiddenFromCommandBlockOrigin = 1 << 1,
18 HiddenFromPlayerOrigin = 1 << 2,
19 HiddenFromAutomationOrigin = 1 << 3,
21 ExecuteDisallowed = 1 << 5,
26 Hidden = HiddenFromPlayerOrigin | HiddenFromCommandBlockOrigin,
27 Removed = Hidden | HiddenFromAutomationOrigin,
30[[nodiscard]]
constexpr CommandFlagValue operator|(
const CommandFlagValue l,
const CommandFlagValue r)
noexcept {
31 return static_cast<CommandFlagValue
>(
32 static_cast<std::underlying_type_t<CommandFlagValue>
>(l)
33 |
static_cast<std::underlying_type_t<CommandFlagValue>
>(r)
36[[nodiscard]]
constexpr CommandFlagValue operator&(
const CommandFlagValue l,
const CommandFlagValue r)
noexcept {
37 return static_cast<CommandFlagValue
>(
38 static_cast<std::underlying_type_t<CommandFlagValue>
>(l)
39 &
static_cast<std::underlying_type_t<CommandFlagValue>
>(r)
45 CommandFlagValue value;
47 CommandFlag() =
default;
49 CommandFlag(CommandFlagValue value) : value(value) {}
51 [[nodiscard]]
constexpr bool operator==(CommandFlag
const& rhs)
const noexcept {
return value == rhs.value; }
52 [[nodiscard]]
constexpr bool operator!=(CommandFlag
const& rhs)
const noexcept {
return value != rhs.value; }
53 CommandFlag& operator|=(CommandFlag
const& rhs) {
54 value = rhs.value | value;
57 CommandFlag& operator|=(CommandFlagValue rhs) {
62 CommandFlag& remove(CommandFlagValue rhs) {
63 value = (CommandFlagValue)((ushort)value & !(ushort)rhs);