From 367672cb443c4f896c85ec05a5e5386140e3be2c Mon Sep 17 00:00:00 2001 From: Rammelkast Date: Thu, 26 May 2016 15:33:27 +0200 Subject: [PATCH] Fixes & Removed tests --- .../anticheat/event/PlayerListener.java | 4 ++- .../anticheat/util/BlockHardnessTest.java | 36 ------------------- .../anticheat/util/GroupTest.java | 31 ---------------- .../anticheat/util/rule/RuleTest.java | 30 ---------------- 4 files changed, 3 insertions(+), 98 deletions(-) delete mode 100644 src/test/java/net/gravitydevelopment/anticheat/util/BlockHardnessTest.java delete mode 100644 src/test/java/net/gravitydevelopment/anticheat/util/GroupTest.java delete mode 100644 src/test/java/net/gravitydevelopment/anticheat/util/rule/RuleTest.java diff --git a/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java b/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java index 7181820..3ebc2a6 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java +++ b/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java @@ -25,6 +25,8 @@ import net.gravitydevelopment.anticheat.check.CheckResult; import net.gravitydevelopment.anticheat.util.Distance; import net.gravitydevelopment.anticheat.util.Permission; import net.gravitydevelopment.anticheat.util.Utilities; + +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; @@ -314,7 +316,7 @@ public class PlayerListener extends EventListener { log(result.getMessage(), player, CheckType.SPRINT); } } - if (getCheckManager().willCheckQuick(player, CheckType.FLY) && !player.isFlying() && !player.isGliding() /*TODO: ElytraFly check, this is a quick workaround */) { + if (getCheckManager().willCheckQuick(player, CheckType.FLY) && !player.isFlying() && (Bukkit.getVersion().contains("1.9") && !player.isGliding()) /*TODO: ElytraFly check, this is a quick workaround */) { CheckResult result = getBackend().checkFlight(player, distance); if (result.failed()) { if (!silentMode()) { diff --git a/src/test/java/net/gravitydevelopment/anticheat/util/BlockHardnessTest.java b/src/test/java/net/gravitydevelopment/anticheat/util/BlockHardnessTest.java deleted file mode 100644 index ff8dc23..0000000 --- a/src/test/java/net/gravitydevelopment/anticheat/util/BlockHardnessTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * AntiCheat for Bukkit. - * Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.gravitydevelopment.anticheat.util; - - -import org.bukkit.Material; -import org.junit.Assert; -import org.junit.Test; - -public class BlockHardnessTest { - - @Test - public void verifyExistence() { - for (Material m : Material.values()) { - if (!BlockHardness.hasBlockHardness(m) && m.isBlock() && m != Material.AIR && m != Material.BEDROCK) { - Assert.fail("Material " + m + " is not accounted for by BlockHardness"); - } - } - } -} diff --git a/src/test/java/net/gravitydevelopment/anticheat/util/GroupTest.java b/src/test/java/net/gravitydevelopment/anticheat/util/GroupTest.java deleted file mode 100644 index 47e9cad..0000000 --- a/src/test/java/net/gravitydevelopment/anticheat/util/GroupTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * AntiCheat for Bukkit. - * Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.gravitydevelopment.anticheat.util; - -import static org.junit.Assert.*; -import org.junit.Test; - -public class GroupTest { - - @Test - public void testSerialization() { - final String test = "Test : 1 : GREEN : COMMAND[ban &player;say hello world]"; - assertNotEquals(Group.load(test).toString(), null); - } -} diff --git a/src/test/java/net/gravitydevelopment/anticheat/util/rule/RuleTest.java b/src/test/java/net/gravitydevelopment/anticheat/util/rule/RuleTest.java deleted file mode 100644 index e121c1d..0000000 --- a/src/test/java/net/gravitydevelopment/anticheat/util/rule/RuleTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * AntiCheat for Bukkit. - * Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.gravitydevelopment.anticheat.util.rule; - -import org.junit.Test; - -public class RuleTest { - - @Test - public void testRegex() { - final String rule = "Check_SPIDER < 0 ? Player.KICK : null"; - assert(Rule.Type.CONDITIONAL.matches(rule)); - } -}