diff --git a/pom.xml b/pom.xml index db758f1..b87116d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ bukkit-repo - http://repo.bukkit.org/content/repositories/releases + http://repo.bukkit.org/content/repositories/snapshots @@ -23,6 +23,16 @@ 1.6 + + org.apache.maven.plugins + maven-surefire-plugin + 2.8.1 + + + **/*Test.* + + + AntiCheat @@ -51,7 +61,7 @@ org.bukkit bukkit - 1.4.6-R0.1 + 1.5-R0.1-SNAPSHOT jar compile @@ -60,7 +70,7 @@ junit 4.11 jar - compile + test diff --git a/src/main/java/net/h31ix/anticheat/util/BlockHardness.java b/src/main/java/net/h31ix/anticheat/util/BlockHardness.java index 315fe58..53cdbc4 100644 --- a/src/main/java/net/h31ix/anticheat/util/BlockHardness.java +++ b/src/main/java/net/h31ix/anticheat/util/BlockHardness.java @@ -43,10 +43,14 @@ public enum BlockHardness { LAPIS_ORE(Material.LAPIS_ORE, 3.00D), LAPIS_BLOCK(Material.LAPIS_BLOCK, 3.00D), DISPENSER(Material.DISPENSER, 3.50D), + DROPPER(Material.DROPPER, 3.50D), SANDSTONE(Material.SANDSTONE, 0.80D), NOTE_BLOCK(Material.NOTE_BLOCK, 0.80D), BED(Material.BED, 0.20D), + RAILS(Material.RAILS, 0.70D), DETECTOR_RAIL(Material.DETECTOR_RAIL, 0.70D), + POWERED_RAIL(Material.POWERED_RAIL, 0.70D), + ACTIVATOR_RAIL(Material.ACTIVATOR_RAIL, 0.70D), WEB(Material.WEB, 4.00D), LONG_GRASS(Material.LONG_GRASS, 0.00D), DEAD_BUSH(Material.DEAD_BUSH, 0.00D), @@ -68,6 +72,7 @@ public enum BlockHardness { FIRE(Material.FIRE, 0.00D), MOB_SPAWNER(Material.MOB_SPAWNER, 5.00D), CHEST(Material.CHEST, 2.50D), + TRAPPED_CHEST(Material.TRAPPED_CHEST, 2.50D), REDSTONE_WIRE(Material.REDSTONE_WIRE, 0.00D), DIAMOND_ORE(Material.DIAMOND_ORE, 3.00D), DIAMOND_BLOCK(Material.DIAMOND_BLOCK, 5.00D), @@ -77,15 +82,24 @@ public enum BlockHardness { BURNING_FURNACE(Material.BURNING_FURNACE, 3.50D), WOODEN_DOOR(Material.WOODEN_DOOR, 3.00D), LADDER(Material.LADDER, 0.40D), - RAILS(Material.RAILS, 0.70D), LEVER(Material.LEVER, 0.50D), - STONE_PLATE(Material.STONE_PLATE, 0.50D), IRON_DOOR_BLOCK(Material.IRON_DOOR_BLOCK, 5.00D), + HOPPER(Material.HOPPER, 2.00D), + STONE_PLATE(Material.STONE_PLATE, 0.50D), WOOD_PLATE(Material.WOOD_PLATE, 0.50D), + GOLD_PLATE(Material.GOLD_PLATE, 0.50D), + IRON_PLATE(Material.IRON_PLATE, 0.50D), + QUARTZ_BLOCK(Material.QUARTZ_BLOCK, 0.80D), + QUARTZ_ORE(Material.QUARTZ_ORE, 3.00D), + QUARTZ_STAIRS(Material.QUARTZ_STAIRS, 0.80D), + REDSTONE_BLOCK(Material.REDSTONE_BLOCK, 5.00D), REDSTONE_ORE(Material.REDSTONE_ORE, 3.00D), GLOWING_REDSTONE_ORE(Material.GLOWING_REDSTONE_ORE, 3.00D), REDSTONE_TORCH_OFF(Material.REDSTONE_TORCH_OFF, 0.00D), REDSTONE_TORCH_ON(Material.REDSTONE_TORCH_ON, 0.00D), + REDSTONE_COMPARATOR_OFF(Material.REDSTONE_COMPARATOR_OFF, 0.00D), + REDSTONE_COMPARATOR_ON(Material.REDSTONE_COMPARATOR_ON, 0.00D), + DAYLIGHT_DETECTOR(Material.DAYLIGHT_DETECTOR, 0.20D), STONE_BUTTON(Material.STONE_BUTTON, 0.50D), SNOW(Material.SNOW, 0.10D), ICE(Material.ICE, 0.50D), @@ -134,7 +148,6 @@ public enum BlockHardness { HUGE_MUSHROOM_1(Material.HUGE_MUSHROOM_1, 0.20D), HUGE_MUSHROOM_2(Material.HUGE_MUSHROOM_2, 0.20D), BED_BLOCK(Material.BED_BLOCK, 0.20D), - POWERED_RAIL(Material.POWERED_RAIL, 0.70D), WOOD_STAIRS(Material.WOOD_STAIRS, 2.00D), COBBLESTONE_STAIRS(Material.COBBLESTONE_STAIRS, 2.00D), BRICK_STAIRS(Material.BRICK_STAIRS, 2.00D), diff --git a/src/test/java/net/h31ix/anticheat/util/BlockHardnessTest.java b/src/test/java/net/h31ix/anticheat/util/BlockHardnessTest.java new file mode 100644 index 0000000..0f10dd2 --- /dev/null +++ b/src/test/java/net/h31ix/anticheat/util/BlockHardnessTest.java @@ -0,0 +1,45 @@ +/* + * AntiCheat for Bukkit. + * Copyright (C) 2012-2013 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.h31ix.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"); + } + } + } + + @Test + public void verifyName() { + for(Material m : Material.values()) { + BlockHardness hardness = BlockHardness.getHardness(m); + if(hardness != null && !hardness.name().equals(m.name())) { + Assert.fail("BlockHardness " + hardness + " and its material " + m + " have mismatched names"); + } + } + } +}