LeviLamina
Loading...
Searching...
No Matches
ExecuteCommandEvent.h
1#pragma once
2
3#include "ll/api/base/Macro.h"
4#include "ll/api/event/Cancellable.h"
5#include "ll/api/event/Event.h"
6
7#include "mc/deps/core/utility/MCRESULT.h"
8#include "mc/server/commands/CommandContext.h"
9#include "mc/server/commands/MinecraftCommands.h"
10
11namespace ll::event::inline command {
12
13class ExecuteCommandEvent : public Event {
14 MinecraftCommands& mMinecraftCommands;
15
16protected:
17 CommandContext& mCommandContext;
18 bool& mSuppressOutput;
19
20 constexpr explicit ExecuteCommandEvent(
21 MinecraftCommands& minecraftCommands,
22 CommandContext& commandContext,
23 bool& suppressOutput
24 )
25 : mMinecraftCommands(minecraftCommands),
26 mCommandContext(commandContext),
27 mSuppressOutput(suppressOutput) {}
28
29public:
30 LLAPI void serialize(CompoundTag&) const override;
31
32 LLNDAPI MinecraftCommands& minecraftCommands() const;
33 LLNDAPI CommandContext const& commandContext() const;
34 LLNDAPI bool const& suppressOutput() const;
35};
36class ExecutingCommandEvent final : public Cancellable<ExecuteCommandEvent> {
37public:
38 constexpr explicit ExecutingCommandEvent(
39 MinecraftCommands& minecraftCommands,
40 CommandContext& commandContext,
41 bool& suppressOutput
42 )
43 : Cancellable(minecraftCommands, commandContext, suppressOutput) {}
44
45 LLAPI void deserialize(CompoundTag const&) override;
46
47 LLNDAPI CommandContext& commandContext() const;
48 LLNDAPI bool& suppressOutput() const;
49};
51 MCRESULT& mResult;
52
53public:
54 constexpr explicit ExecutedCommandEvent(
55 MCRESULT& result,
56 MinecraftCommands& minecraftCommands,
57 CommandContext& commandContext,
58 bool& suppressOutput
59 )
60 : ExecuteCommandEvent(minecraftCommands, commandContext, suppressOutput),
61 mResult(result) {}
62
63 LLAPI void serialize(CompoundTag&) const override;
64
65 LLNDAPI MCRESULT& result() const;
66};
67} // namespace ll::event::inline command
Definition CommandContext.h:10
Definition CompoundTag.h:13
Definition MinecraftCommands.h:33
Definition ExecuteCommandEvent.h:13
Definition ExecuteCommandEvent.h:50
Definition ExecuteCommandEvent.h:36
Definition MCRESULT.h:8
Definition serialize.h:11