1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Added a new super tag

This commit is contained in:
TheBusyBiscuit 2020-10-04 13:31:52 +02:00
parent 7cab529a2b
commit 655b429f0d
3 changed files with 26 additions and 2 deletions

View File

@ -164,6 +164,12 @@ public enum SlimefunTag implements Tag<Material> {
* All <strong>weak</strong> materials which the {@link ClimbingPick} is able to climb.
*/
CLIMBING_PICK_WEAK_SURFACES,
/**
* This {@link SlimefunTag} holds all surfaces for the {@link ClimbingPick}.
* This is an aggregation of {@code CLIMBING_PICK_STRONG_SURFACES} and {@code CLIMBING_PICK_WEAK_SURFACES}
*/
CLIMBING_PICK_SURFACES,
/**
* All materials (ores) which trigger the Talisman of the Caveman.

View File

@ -0,0 +1,6 @@
{
"values" : [
"#slimefun:climbing_pick_strong_surfaces",
"#slimefun:climbing_pick_weak_surfaces"
]
}

View File

@ -83,10 +83,10 @@ class TestClimbingPick implements SlimefunItemTest<ClimbingPick> {
@DisplayName("Test Climbing Pick on strong surfaces")
@MethodSource("getStrongSurfaces")
void testStrongSurfaces(Material surface) {
Assertions.assertFalse(SlimefunTag.CLIMBING_PICK_STRONG_SURFACES.getValues().isEmpty());
ClimbingPick pick = registerSlimefunItem(plugin, "STRONG_CLIMBING_PICK_" + surface.name());
double speed = pick.getClimbingSpeed(surface);
Assertions.assertTrue(SlimefunTag.CLIMBING_PICK_STRONG_SURFACES.isTagged(surface));
Assertions.assertEquals(STRONG_SURFACE_DEFAULT, speed);
Assertions.assertEquals(1, pick.getClimbableSurfaces().stream().filter(s -> s.getType() == surface).count());
}
@ -101,10 +101,10 @@ class TestClimbingPick implements SlimefunItemTest<ClimbingPick> {
@DisplayName("Test Climbing Pick on weak surfaces")
@MethodSource("getWeakSurfaces")
void testWeakSurfaces(Material surface) {
Assertions.assertFalse(SlimefunTag.CLIMBING_PICK_WEAK_SURFACES.getValues().isEmpty());
ClimbingPick pick = registerSlimefunItem(plugin, "WEAK_CLIMBING_PICK_" + surface.name());
double speed = pick.getClimbingSpeed(surface);
Assertions.assertTrue(SlimefunTag.CLIMBING_PICK_WEAK_SURFACES.isTagged(surface));
Assertions.assertEquals(WEAK_SURFACE_DEFAULT, speed);
Assertions.assertEquals(1, pick.getClimbableSurfaces().stream().filter(s -> s.getType() == surface).count());
}
@ -115,11 +115,23 @@ class TestClimbingPick implements SlimefunItemTest<ClimbingPick> {
return SlimefunTag.CLIMBING_PICK_WEAK_SURFACES.getValues().stream().map(Arguments::of);
}
@Test
@DisplayName("Test Climbing Pick on climbable surface")
void testClimbable() {
ClimbingPick pick = registerSlimefunItem(plugin, "WEAK_CLIMBING_PICK");
double speed = pick.getClimbingSpeed(Material.ICE);
Assertions.assertFalse(SlimefunTag.CLIMBING_PICK_SURFACES.isTagged(Material.ICE));
Assertions.assertTrue(speed > 0);
}
@Test
@DisplayName("Test Climbing Pick on non-climbable surface")
void testNonClimbable() {
ClimbingPick pick = registerSlimefunItem(plugin, "NOT_CLIMBING_PICK");
double speed = pick.getClimbingSpeed(Material.DRAGON_EGG);
Assertions.assertFalse(SlimefunTag.CLIMBING_PICK_SURFACES.isTagged(Material.DRAGON_EGG));
Assertions.assertEquals(0, speed);
}