noclip/speed detection in games should only when the specific hack disabled, not just when any hack is disabled

This commit is contained in:
UnknownShadow200 2018-07-14 12:29:04 +10:00
parent 4789a22656
commit c309addf99
4 changed files with 13 additions and 5 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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) {