From 41b05416c75b9cbe31406f04b58b5da9892872f8 Mon Sep 17 00:00:00 2001 From: Mike Hunsinger Date: Thu, 23 Jan 2014 00:27:39 -0700 Subject: Split TossItem into three Toss functions (Held, Equipped and Pickup) --- src/ClientHandle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 74d192129..ab3c85ba9 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -658,7 +658,8 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, ch // A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch) return; } - m_Player->TossItem(false); + + m_Player->TossEquippedItem(); return; } @@ -713,7 +714,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, ch // A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch) return; } - m_Player->TossItem(false, 64); // Toss entire slot - if there aren't enough items, the maximum will be ejected + m_Player->TossEquippedItem(64); // Toss entire slot - if there aren't enough items, the maximum will be ejected return; } -- cgit v1.2.3 From 4ef61d8bf6d815b164a32bdab6a18744cbf0abd2 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 23 Jan 2014 14:57:04 +0200 Subject: Command block fixes 2 --- src/ClientHandle.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/ClientHandle.cpp') 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())); + } } -- cgit v1.2.3 From 6c1d992eeba5c300da1a2b7a50fbda52b3774ff4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 24 Jan 2014 22:23:33 +0100 Subject: Fixed a possible deadlock on client disconnect. --- src/ClientHandle.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 18e3d560e..56ad4e4ba 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -148,15 +148,6 @@ cClientHandle::~cClientHandle() SendDisconnect("Server shut down? Kthnxbai"); } - // Queue all remaining outgoing packets to cSocketThreads: - { - cCSLock Lock(m_CSOutgoingData); - AString Data; - m_OutgoingData.ReadAll(Data); - m_OutgoingData.CommitRead(); - cRoot::Get()->GetServer()->WriteToClient(this, Data); - } - // Close the socket as soon as it sends all outgoing data: cRoot::Get()->GetServer()->RemoveClient(this); -- cgit v1.2.3 From 6fa3a0cf70bd631fe809c006e5b315199086cc59 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 25 Jan 2014 19:05:44 +0000 Subject: Two minor changes --- src/ClientHandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 18e3d560e..68bf28af7 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -620,7 +620,7 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a } else { - SendChat(Printf("%s[INFO]%s Command blocks are not enabled on this server", cChatColor::Green.c_str(), cChatColor::White.c_str())); + SendChat(Printf("%s[INFO]%s Command blocks are not enabled on this server", cChatColor::Yellow.c_str(), cChatColor::White.c_str())); } } -- cgit v1.2.3