diff options
author | Mattes D <github@xoft.cz> | 2014-02-23 23:06:50 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-02-23 23:06:50 +0100 |
commit | f8586b8e9d2ef38a0e52d958f8378a63a1617b41 (patch) | |
tree | 1951032fa902b4787294f4e6a51d368d5e21d2af | |
parent | Merge pull request #717 from worktycho/warningfixes (diff) | |
parent | Use the ItemCategorie::IsSword() Method. (diff) | |
download | cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar.gz cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar.bz2 cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar.lz cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar.xz cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.tar.zst cuberite-f8586b8e9d2ef38a0e52d958f8378a63a1617b41.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 3711262b6..4715eb100 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() && + ItemCategory::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: |