9 #include "../CommandOutput.h"
11 #include "../Server.h"
12 #include "../ChatColor.h"
14 #include "../ClientHandle.h"
21 Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
22 m_ShouldExecute(false),
161 class CommandBlockOutCb :
169 virtual void Out(
const AString & a_Text)
override
179 if (RealCommand[0] ==
'/')
181 RealCommand = RealCommand.substr(1, RealCommand.length());
186 (RealCommand !=
"stop") &&
187 (RealCommand !=
"restart") &&
188 (RealCommand !=
"kick") &&
189 (RealCommand !=
"ban") &&
190 (RealCommand !=
"ipban")
194 LOGD(
"cCommandBlockEntity: Executing command %s",
m_Command.c_str());
200 LOGD(
"cCommandBlockEntity: Prevented execution of administration command %s",
m_Command.c_str());
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
cWorld * GetWorld() const
virtual void CopyFrom(const cBlockEntity &a_Src)
Copies all properties of a_Src into this entity, except for its m_World and location.
cCommandBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Creates a new empty command block entity.
const AString & GetLastOutput(void) const
Retrieves the last line of output generated by the command block.
void Activate(void)
Sets the command block to execute a command in the next tick.
void Execute()
Executes the associated command.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking.
NIBBLETYPE GetResult(void) const
Retrieves the result (signal strength) of the last operation.
void SetLastOutput(const AString &a_LastOut)
void SetResult(const NIBBLETYPE a_Result)
void SetCommand(const AString &a_Cmd)
Sets the command.
const AString & GetCommand(void) const
Retrieves stored command.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
static const char * White
static const char * Green
static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, const AString &a_ChatPrefixS, const AString &m_Color1, const AString &m_Color2)
void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity)
Sends all command output to a log, line by line; deletes self when command finishes processing.
cServer * GetServer(void)
void QueueExecuteConsoleCommand(const AString &a_Cmd, cCommandOutputCallback &a_Output)
Queues a console command for execution through the cServer class.
bool ShouldUseChatPrefixes(void) const
bool AreCommandBlocksEnabled(void) const