summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormathiascode <mathiascode@users.noreply.github.com>2017-05-19 16:09:01 +0200
committerLukas Pioch <lukas@zgow.de>2017-05-19 19:51:03 +0200
commit8cf48f7682a2f75363fc4b4af8f9bfba028818c0 (patch)
tree6001f58c0a3f40e05c7d2588197d24930a83052b
parentUse FastWriter instead of StyledWriter (diff)
downloadcuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar.gz
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar.bz2
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar.lz
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar.xz
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.tar.zst
cuberite-8cf48f7682a2f75363fc4b4af8f9bfba028818c0.zip
-rw-r--r--src/ClientHandle.cpp2
-rw-r--r--src/Server.cpp1
-rw-r--r--src/Server.h6
3 files changed, 8 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index f82166820..669138f72 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2016,7 +2016,7 @@ bool cClientHandle::CheckBlockInteractionsRate(void)
ASSERT(m_Player != nullptr);
ASSERT(m_Player->GetWorld() != nullptr);
- if (m_NumBlockChangeInteractionsThisTick > MAX_BLOCK_CHANGE_INTERACTIONS)
+ if ((cRoot::Get()->GetServer()->ShouldLimitPlayerBlockChanges()) && (m_NumBlockChangeInteractionsThisTick > MAX_BLOCK_CHANGE_INTERACTIONS))
{
return false;
}
diff --git a/src/Server.cpp b/src/Server.cpp
index 95e0b535b..fbd190f0d 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -236,6 +236,7 @@ bool cServer::InitServer(cSettingsRepositoryInterface & a_Settings, bool a_Shoul
}
m_ShouldAllowMultiWorldTabCompletion = a_Settings.GetValueSetB("Server", "AllowMultiWorldTabCompletion", true);
+ m_ShouldLimitPlayerBlockChanges = a_Settings.GetValueSetB("AntiCheat", "LimitPlayerBlockChanges", true);
m_ShouldLoadOfflinePlayerData = a_Settings.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false);
m_ShouldLoadNamedPlayerData = a_Settings.GetValueSetB("PlayerData", "LoadNamedPlayerData", true);
diff --git a/src/Server.h b/src/Server.h
index 74f9581ae..bb9b7f511 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -127,6 +127,9 @@ public:
/** Returns true if authentication has been turned on in server settings. */
bool ShouldAuthenticate(void) const { return m_ShouldAuthenticate; } // tolua_export
+ /** Returns true if limit for number of block changes per tick by a player has been turned on in server settings. */
+ bool ShouldLimitPlayerBlockChanges(void) const { return m_ShouldLimitPlayerBlockChanges; }
+
/** Returns true if offline UUIDs should be used to load data for players whose normal UUIDs cannot be found.
Loaded from the settings.ini [PlayerData].LoadOfflinePlayerData setting. */
bool ShouldLoadOfflinePlayerData(void) const { return m_ShouldLoadOfflinePlayerData; }
@@ -224,6 +227,9 @@ private:
This setting is the same as the "online-mode" setting in Vanilla. */
bool m_ShouldAuthenticate;
+ /** True if limit for number of block changes per tick by a player should be enabled. */
+ bool m_ShouldLimitPlayerBlockChanges;
+
/** True if offline UUIDs should be used to load data for players whose normal UUIDs cannot be found.
This allows transitions from an offline (no-auth) server to an online one.
Loaded from the settings.ini [PlayerData].LoadOfflinePlayerData setting. */