From c309addf996260a67b67e4804f856a48ac8d8178 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 14 Jul 2018 12:29:04 +1000 Subject: [PATCH] noclip/speed detection in games should only when the specific hack disabled, not just when any hack is disabled --- MCGalaxy/Commands/Fun/RateMapCmds.cs | 1 + MCGalaxy/Database/Backends/SQLite.cs | 2 +- MCGalaxy/Games/MovementCheck.cs | 4 ++-- MCGalaxy/Levels/Hacks.cs | 11 +++++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/MCGalaxy/Commands/Fun/RateMapCmds.cs b/MCGalaxy/Commands/Fun/RateMapCmds.cs index bfc741e22..69c4f7132 100644 --- a/MCGalaxy/Commands/Fun/RateMapCmds.cs +++ b/MCGalaxy/Commands/Fun/RateMapCmds.cs @@ -41,6 +41,7 @@ namespace MCGalaxy.Commands.Fun { if (like) p.level.Config.Likes++; else p.level.Config.Dislikes++; + p.Game.RatedMap = true; p.Game.LikedMap = like; Level.SaveSettings(p.level); diff --git a/MCGalaxy/Database/Backends/SQLite.cs b/MCGalaxy/Database/Backends/SQLite.cs index 547c15f93..36701f0de 100644 --- a/MCGalaxy/Database/Backends/SQLite.cs +++ b/MCGalaxy/Database/Backends/SQLite.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.SQL { public override bool MultipleSchema { get { return false; } } internal override IDbConnection CreateConnection() { - const string format = "Data Source={0}/MCGalaxy.db;Version=3;Pooling={1};Max Pool Size=300;"; + const string format = "Data Source={0}/MCGalaxy.db;Pooling={1};Max Pool Size=300;"; string str = string.Format(format, Utils.FolderPath, ServerConfig.DatabasePooling); return new SQLiteConnection(str); } diff --git a/MCGalaxy/Games/MovementCheck.cs b/MCGalaxy/Games/MovementCheck.cs index d2712a060..730161ec1 100644 --- a/MCGalaxy/Games/MovementCheck.cs +++ b/MCGalaxy/Games/MovementCheck.cs @@ -28,7 +28,7 @@ namespace MCGalaxy.Games { } public static bool DetectNoclip(Player p, Position newPos) { - if (p.Game.Referee || Hacks.CanUseHacks(p, p.level)) return false; + if (p.Game.Referee || Hacks.CanUseNoclip(p, p.level)) return false; if (!p.CheckIfInsideBlock() || p.Game.NoclipLog.AddSpamEntry(5, 1)) return false; @@ -37,7 +37,7 @@ namespace MCGalaxy.Games { } public static bool DetectSpeedhack(Player p, Position newPos, float moveDist) { - if (p.Game.Referee || Hacks.CanUseHacks(p, p.level)) return false; + if (p.Game.Referee || Hacks.CanUseSpeed(p, p.level)) return false; int dx = Math.Abs(p.Pos.X - newPos.X), dz = Math.Abs(p.Pos.Z - newPos.Z); int maxMove = (int)(moveDist * 32); diff --git a/MCGalaxy/Levels/Hacks.cs b/MCGalaxy/Levels/Hacks.cs index e2e8a95f5..2b1f44570 100644 --- a/MCGalaxy/Levels/Hacks.cs +++ b/MCGalaxy/Levels/Hacks.cs @@ -27,8 +27,15 @@ namespace MCGalaxy { } public static bool CanUseFly(Player p, Level lvl) { - byte[] packet = MakeHackControl(p, lvl.GetMotd(p)); - return packet[1] != 0; + return MakeHackControl(p, lvl.GetMotd(p))[1] != 0; + } + + public static bool CanUseNoclip(Player p, Level lvl) { + return MakeHackControl(p, lvl.GetMotd(p))[2] != 0; + } + + public static bool CanUseSpeed(Player p, Level lvl) { + return MakeHackControl(p, lvl.GetMotd(p))[3] != 0; } public static byte[] MakeHackControl(Player p, string motd) {