summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-23 13:57:04 +0100
committerandrew <xdotftw@gmail.com>2014-01-23 13:57:04 +0100
commit4ef61d8bf6d815b164a32bdab6a18744cbf0abd2 (patch)
treefc0c615aba88114ce209b99e7e8c8c5d925117bb /src/ClientHandle.cpp
parentMerge pull request #566 from xdot/master (diff)
downloadcuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.gz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.bz2
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.lz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.xz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.zst
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0a2d3c1be..ed04edac0 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -610,25 +610,18 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a
}
}
- class cUpdateCommandBlock :
- public cCommandBlockCallback
- {
- AString m_Command;
- public:
- cUpdateCommandBlock(const AString & a_Command) : m_Command(a_Command) {}
-
- virtual bool Item(cCommandBlockEntity * a_CommandBlock) override
- {
- a_CommandBlock->SetCommand(m_Command);
- return false;
- }
- } CmdBlockCB (Command);
-
cWorld * World = m_Player->GetWorld();
- World->DoWithCommandBlockAt(BlockX, BlockY, BlockZ, CmdBlockCB);
+ if (World->AreCommandBlocksEnabled())
+ {
+ World->SetCommandBlockCommand(BlockX, BlockY, BlockZ, Command);
- SendChat(Printf("%s[INFO]%s Successfully set command block command", cChatColor::Green.c_str(), cChatColor::White.c_str()));
+ SendChat(Printf("%s[INFO]%s Successfully set command block command", cChatColor::Green.c_str(), cChatColor::White.c_str()));
+ }
+ else
+ {
+ SendChat(Printf("%s[INFO]%s Command blocks are not enabled on this server", cChatColor::Green.c_str(), cChatColor::White.c_str()));
+ }
}