From ceadd2147f4ff300b0f46934a6d27d9e9f28b48d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 4 Oct 2020 11:51:03 +0200 Subject: [PATCH] Added a debug line to finally fix this unit test --- .../slimefun4/api/items/ItemSetting.java | 9 ++++++++- .../implementation/items/tools/ClimbingPick.java | 15 ++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java index ce98a6a35..774265809 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java @@ -133,7 +133,14 @@ public class ItemSetting { Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getID() + '.' + getKey()); if (defaultValue.getClass().isInstance(configuredValue)) { - this.value = (T) configuredValue; + if (validateInput((T) configuredValue)) { + this.value = (T) configuredValue; + } + else { + Slimefun.getLogger().log(Level.WARNING, "Slimefun has found an invalid config setting in your Items.yml!"); + Slimefun.getLogger().log(Level.WARNING, " at \"{0}.{1}\"", new Object[] { item.getID(), getKey() }); + Slimefun.getLogger().log(Level.WARNING, "{0} is not a valid input!", configuredValue); + } } else { this.value = defaultValue; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java index a337be904..7f3163d96 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java @@ -122,7 +122,14 @@ public class ClimbingPick extends SimpleSlimefunItem implements public double getClimbingSpeed(@Nonnull Material type) { Validate.notNull(type, "The surface cannot be null"); ClimbableSurface surface = surfaces.get(type); - return surface != null ? surface.getValue() : 0; + + if (surface != null) { + System.out.println(surface.getValue()); + return surface.getValue(); + } + else { + return 0; + } } /** @@ -168,11 +175,9 @@ public class ClimbingPick extends SimpleSlimefunItem implements } // Top and bottom faces won't be allowed - if (e.getClickedFace() == BlockFace.DOWN || e.getClickedFace() == BlockFace.UP) { - return; + if (e.getClickedFace() != BlockFace.DOWN && e.getClickedFace() != BlockFace.UP) { + climb(p, e.getHand(), e.getItem(), block); } - - climb(p, e.getHand(), e.getItem(), block); }; }