diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-07-31 21:50:40 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-08-01 08:21:20 +0200 |
commit | 8eb5672920f8834ffe6edbff62713963b8d2ba3d (patch) | |
tree | 9c63da705ae076f8989414a3bc123d0a12866d59 | |
parent | Updated plugin Core (diff) | |
download | cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar.gz cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar.bz2 cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar.lz cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar.xz cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.tar.zst cuberite-8eb5672920f8834ffe6edbff62713963b8d2ba3d.zip |
-rw-r--r-- | src/Blocks/BlockComparator.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.cpp | 6 | ||||
-rw-r--r-- | src/Blocks/BlockFenceGate.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockRedstoneRepeater.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockSlab.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockTNT.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockTrapdoor.h | 2 | ||||
-rw-r--r-- | src/Blocks/WorldInterface.h | 2 | ||||
-rw-r--r-- | src/ChunkMap.cpp | 4 | ||||
-rw-r--r-- | src/ChunkMap.h | 2 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 28 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 4 | ||||
-rw-r--r-- | src/Items/ItemHandler.cpp | 4 | ||||
-rw-r--r-- | src/World.cpp | 2 | ||||
-rw-r--r-- | src/World.h | 2 |
15 files changed, 33 insertions, 33 deletions
diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index 5ba17c691..b6fc66fff 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -29,7 +29,7 @@ public: virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override { UNUSED(a_ChunkInterface); - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index 2662dc261..251a3146a 100644 --- a/src/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp @@ -87,18 +87,18 @@ void cBlockDoorHandler::OnCancelRightClick(cChunkInterface & a_ChunkInterface, c { UNUSED(a_ChunkInterface); - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (Meta & 0x8) { // Current block is top of the door - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, *a_Player); } else { // Current block is bottom of the door - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *a_Player); } } diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index 57eaeadc4..c5e37cdb6 100644 --- a/src/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h @@ -56,7 +56,7 @@ public: virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override { - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } virtual bool IsUseable(void) override diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index 54e87bb32..832a759ef 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -39,7 +39,7 @@ public: virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override { UNUSED(a_ChunkInterface); - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 01e9e701d..a07c9e065 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -104,7 +104,7 @@ public: } // Sends the slab back to the client. It's to refuse a doubleslab placement. */ - a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } /** Converts the single-slab blocktype to its equivalent double-slab blocktype */ diff --git a/src/Blocks/BlockTNT.h b/src/Blocks/BlockTNT.h index a49b8bbfe..87e60fd88 100644 --- a/src/Blocks/BlockTNT.h +++ b/src/Blocks/BlockTNT.h @@ -18,7 +18,7 @@ public: virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override { - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 1100cccf1..b66123e01 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -47,7 +47,7 @@ public: virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override { UNUSED(a_ChunkInterface); - a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player); } virtual bool GetPlacementBlockTypeMeta( diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index bac6e2bdf..62fd3bb7d 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -47,7 +47,7 @@ public: virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) = 0; /** Sends the block on those coords to the player */ - virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer * a_Player) = 0; + virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer & a_Player) = 0; /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ virtual bool ForEachPlayer(cItemCallback<cPlayer> & a_Callback) = 0; diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 491bc4752..9c662f863 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1371,7 +1371,7 @@ bool cChunkMap::DigBlock(int a_BlockX, int a_BlockY, int a_BlockZ) -void cChunkMap::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) +void cChunkMap::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer & a_Player) { int ChunkX, ChunkZ; cChunkDef::AbsoluteToRelative(a_X, a_Y, a_Z, ChunkX, ChunkZ); @@ -1380,7 +1380,7 @@ void cChunkMap::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) cChunkPtr Chunk = GetChunk(ChunkX, ChunkZ); if ((Chunk != nullptr) && (Chunk->IsValid())) { - Chunk->SendBlockTo(a_X, a_Y, a_Z, a_Player->GetClientHandle()); + Chunk->SendBlockTo(a_X, a_Y, a_Z, a_Player.GetClientHandle()); } } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 130c4b062..79c929402 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -191,7 +191,7 @@ public: /** Sends the block at the specified coords to the specified player. Uses a blockchange packet to send the block. If the relevant chunk isn't loaded, doesn't do anything. */ - void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer * a_Player); + void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer & a_Player); /** Compares clients of two chunks, calls the callback accordingly */ void CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 3270cc37f..3f7a2c724 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1075,7 +1075,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB (Diff(m_Player->GetPosZ(), static_cast<double>(a_BlockZ)) > 6)) ) { - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); return; } } @@ -1084,7 +1084,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB if (m_Player->IsFrozen() || PlgMgr->CallHookPlayerLeftClick(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, static_cast<char>(a_Status))) { // A plugin doesn't agree with the action, replace the block on the client and quit: - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side. return; } @@ -1211,7 +1211,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc (Diff(m_Player->GetPosZ(), static_cast<double>(a_BlockZ)) > 6) ) { - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); return; } @@ -1296,8 +1296,8 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo { LOGD("Break progress of player %s was less than expected: %f < %f\n", m_Player->GetName().c_str(), m_BreakProgress * 100, FASTBREAK_PERCENTAGE * 100); // AntiFastBreak doesn't agree with the breaking. Bail out. Send the block back to the client, so that it knows: - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // Strange bug with doors + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // Strange bug with doors SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side. m_Player->SendMessage("FastBreak?"); // TODO Anticheat hook return; @@ -1310,8 +1310,8 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo 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: - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); - m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // Strange bug with doors + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); + m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // Strange bug with doors SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side. return; } @@ -1394,15 +1394,15 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e { if (cChunkDef::IsValidHeight(a_BlockY)) { - World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); } if (cChunkDef::IsValidHeight(a_BlockY + 1)) { - World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // 2 block high things + World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // 2 block high things } if (cChunkDef::IsValidHeight(a_BlockY - 1)) { - World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, m_Player); // 2 block high things + World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, *m_Player); // 2 block high things } } m_Player->GetInventory().SendEquippedSlot(); @@ -1430,15 +1430,15 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); if (cChunkDef::IsValidHeight(a_BlockY)) { - World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); } if (cChunkDef::IsValidHeight(a_BlockY + 1)) { - World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // 2 block high things + World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // 2 block high things } if (cChunkDef::IsValidHeight(a_BlockY - 1)) { - World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, m_Player); // 2 block high things + World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, *m_Player); // 2 block high things } m_Player->GetInventory().SendEquippedSlot(); } @@ -1469,7 +1469,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e if (a_BlockFace != BLOCK_FACE_NONE) { AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); + World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player); } return; } diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index f66f2b73d..9a5d6cf58 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2733,7 +2733,7 @@ bool cPlayer::PlaceBlocks(const sSetBlockVector & a_Blocks) // Abort - re-send all the current blocks in the a_Blocks' coords to the client: for (auto blk2: a_Blocks) { - m_World->SendBlockTo(blk2.GetX(), blk2.GetY(), blk2.GetZ(), this); + m_World->SendBlockTo(blk2.GetX(), blk2.GetY(), blk2.GetZ(), *this); } return false; } @@ -2747,7 +2747,7 @@ bool cPlayer::PlaceBlocks(const sSetBlockVector & a_Blocks) // Abort - re-send all the current blocks in the a_Blocks' coords to the client: for (auto blk2: a_Blocks) { - m_World->SendBlockTo(blk2.GetX(), blk2.GetY(), blk2.GetZ(), this); + m_World->SendBlockTo(blk2.GetX(), blk2.GetY(), blk2.GetZ(), *this); } return false; } diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index c34b8b444..666ada904 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -395,9 +395,9 @@ bool cItemHandler::OnPlayerPlace( // Handler refused the placement, send that information back to the client: for (const auto & blk: blocks) { - a_World.SendBlockTo(blk.GetX(), blk.GetY(), blk.GetZ(), &a_Player); + a_World.SendBlockTo(blk.GetX(), blk.GetY(), blk.GetZ(), a_Player); } - a_World.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, &a_Player); + a_World.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); a_Player.GetInventory().SendEquippedSlot(); return false; } diff --git a/src/World.cpp b/src/World.cpp index a33f1fa97..fded38169 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2385,7 +2385,7 @@ bool cWorld::DigBlock(int a_X, int a_Y, int a_Z) -void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) +void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer & a_Player) { m_ChunkMap->SendBlockTo(a_X, a_Y, a_Z, a_Player); } diff --git a/src/World.h b/src/World.h index f1f0b307f..3acb4676d 100644 --- a/src/World.h +++ b/src/World.h @@ -482,7 +482,7 @@ public: // tolua_begin bool DigBlock (int a_X, int a_Y, int a_Z); - virtual void SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) override; + virtual void SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer & a_Player) override; /** Set default spawn at the given coordinates. Returns false if the new spawn couldn't be stored in the INI file. */ |