1
0
Fork 0

Merge pull request #716 from Howaner/BreakFix

No Sword Block Destroying in Creative Mode
This commit is contained in:
Mattes D 2014-02-23 23:06:50 +01:00
commit f8586b8e9d
1 changed files with 10 additions and 0 deletions

View File

@ -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: