summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-23 20:02:44 +0100
committerHowaner <franzi.moos@googlemail.com>2014-02-23 20:02:44 +0100
commitcc34898e45113df8ad7ae4b58debd2fe000f9622 (patch)
tree5218db21447a627af29ea68a4a2b28571a9cb7b2 /src/ClientHandle.cpp
parentUpdated CONTRIBUTING file with formatting and essential rules. (diff)
downloadcuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar.gz
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar.bz2
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar.lz
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar.xz
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.tar.zst
cuberite-cc34898e45113df8ad7ae4b58debd2fe000f9622.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 3711262b6..38301b86f 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -32,6 +32,7 @@
#include "Protocol/ProtocolRecognizer.h"
#include "CompositeChat.h"
+#include "Items/ItemSword.h"
@@ -794,6 +795,15 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc
return;
}
+ if (
+ m_Player->IsGameModeCreative() &&
+ cItemSwordHandler::IsSword(m_Player->GetInventory().GetEquippedItem().m_ItemType)
+ )
+ {
+ // Players can't destroy blocks with a Sword in the hand.
+ return;
+ }
+
if (cRoot::Get()->GetPluginManager()->CallHookPlayerBreakingBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_OldBlock, a_OldMeta))
{
// A plugin doesn't agree with the breaking. Bail out. Send the block back to the client, so that it knows: