From 211b331d4d1cbecada9be7cd0b7e558f8822a7fe Mon Sep 17 00:00:00 2001 From: stijnb1234 Date: Thu, 6 Feb 2020 17:56:27 +0100 Subject: [PATCH] Fixed some rotation issues --- pom.xml | 6 ------ .../V10Lift/API/Objects/LiftBlock.java | 4 ++-- .../V10Lift/Utils/DirectionUtil.java | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 2fad641..d00f140 100644 --- a/pom.xml +++ b/pom.xml @@ -90,12 +90,6 @@ 1.18.10 provided - - - com.google.code.gson - gson - 2.8.6 - diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java index d020b59..8552487 100644 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java +++ b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java @@ -20,7 +20,7 @@ public class LiftBlock implements Comparable { @Getter private final Material mat; @Getter private final byte data; @Getter private final BlockFace face; - @Getter private final Object bisected; + @Getter private final String bisected; @Getter private final String[] signLines; //Only used for inputs! @@ -105,7 +105,7 @@ public class LiftBlock implements Comparable { } /* 1.13 liftblock (dir & bisec) */ - public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, Object bisected) { + public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String bisected) { this.world = world; this.x = x; this.y = y; diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java b/src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java index 95e1184..ab42110 100644 --- a/src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java +++ b/src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java @@ -30,19 +30,27 @@ public class DirectionUtil { } @Nullable - public static Object getBisected(@Nonnull Block block) { + public static String getBisected(@Nonnull Block block) { if (block.getBlockData() instanceof Bisected) { Bisected bis = (Bisected) block.getBlockData(); - return bis.getHalf(); + return bis.getHalf().toString(); } return null; } - public static void setBisected(@Nonnull Block block, Object bisected) { - if (bisected != null && block.getBlockData() instanceof Bisected && bisected instanceof Bisected.Half) { + public static void setBisected(@Nonnull Block block, String bisected) { + if (bisected != null && block.getBlockData() instanceof Bisected) { + + Bisected.Half half; + try { + half = Bisected.Half.valueOf(bisected); + } catch (IllegalArgumentException e) { + return; + } + BlockData bd = block.getBlockData(); Bisected bis = (Bisected) bd; - bis.setHalf((Bisected.Half) bisected); + bis.setHalf(half); block.setBlockData(bd); } }