diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2022-01-02 17:37:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 17:37:57 +0100 |
commit | efeedcbd4dc2b115ac0737fc397bde64d6b9656a (patch) | |
tree | 9c93123f21a8edb7bd43004701a788d1e77dfbdc | |
parent | Fixed diagonal redstone powering (#5363) (diff) | |
download | cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar.gz cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar.bz2 cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar.lz cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar.xz cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.tar.zst cuberite-efeedcbd4dc2b115ac0737fc397bde64d6b9656a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 17 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 4 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 2 |
3 files changed, 11 insertions, 12 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 16c040e49..c2135777b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -815,8 +815,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) { if (a_Enchantment > 2) { - LOGWARNING("%s attempt to crash the server with invalid enchanting selection (%u)!", GetUsername().c_str(), a_Enchantment); - Kick("Selected invalid enchantment - hacked client?"); + LOGD("Player \"%s\" tried to select an invalid enchantment - hacked client?", m_Username.c_str()); return; } @@ -827,7 +826,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) (m_Player->GetWindow()->GetWindowType() != cWindow::wtEnchantment) ) { - Kick("Enchantment with invalid window - hacked client?"); + LOGD("Player \"%s\" tried to enchant without a valid window - hacked client?", m_Username.c_str()); return; } @@ -866,7 +865,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) else { // Not creative and can't afford enchantment, so exit: - Kick("Selected unavailable enchantment - hacked client?"); + LOGD("Player \"%s\" selected unavailable enchantment - hacked client?", m_Username.c_str()); return; } } @@ -1039,9 +1038,10 @@ void cClientHandle::HandleCommandBlockBlockChange(int a_BlockX, int a_BlockY, in { if (a_NewCommand.empty()) { - Kick("Command block string unexpectedly empty - hacked client?"); + LOGD("Player \"%s\" send an empty command block string - hacked client?", m_Username.c_str()); return; } + if ((m_Player == nullptr) || !m_Player->HasPermission("comandblock.set")) { SendChat("You cannot edit command blocks on this server", mtFailure); @@ -1562,10 +1562,9 @@ void cClientHandle::HandleChat(const AString & a_Message) { if ((a_Message.size()) > MAX_CHAT_MSG_LENGTH) { - Kick("Please don't exceed the maximum message length of " + std::to_string(MAX_CHAT_MSG_LENGTH)); + LOGD("Player \"%s\" sent a chat message exceeding the maximum length - hacked client?", m_Username.c_str()); return; } - // We no longer need to postpone message processing, because the messages already arrive in the Tick thread // If a command, perform it: AString Message(a_Message); @@ -1699,7 +1698,7 @@ void cClientHandle::HandleSpectate(const cUUID & a_PlayerUUID) { if (!m_Player->IsGameModeSpectator()) { - Kick("Tried to use spectator mode when not in game mode spectator."); + LOGD("Player \"%s\" tried to spectate when not in spectator mode - hacked client?", m_Username.c_str()); return; } @@ -1924,7 +1923,7 @@ void cClientHandle::HandleRespawn(void) { if (m_Player->GetHealth() > 0) { - Kick("What is not dead may not live again. Hacked client?"); + LOGD("Player \"%s\" tried to respawn while alive - hacked client?", m_Username.c_str()); return; } diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 755bcb969..012821c61 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2455,7 +2455,7 @@ void cProtocol_1_8_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) if (PlayerID != m_Client->GetPlayer()->GetUniqueID()) { - m_Client->Kick("Mind your own business! Hacked client?"); + LOGD("Player \"%s\" attempted to action another entity - hacked client?", m_Client->GetUsername().c_str()); return; } @@ -2840,7 +2840,7 @@ void cProtocol_1_8_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con } default: { - m_Client->Kick("Unknown command block edit type - hacked client?"); + LOGD("Player \"%s\" sent an invalid command block edit type - hacked client?", m_Client->GetUsername().c_str()); return; } } diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index d7488a3a6..587b01f0d 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -938,7 +938,7 @@ void cProtocol_1_9_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) if (PlayerID != m_Client->GetPlayer()->GetUniqueID()) { - m_Client->Kick("Mind your own business! Hacked client?"); + LOGD("Player \"%s\" attempted to action another entity - hacked client?", m_Client->GetUsername().c_str()); return; } |