From fd6fbebd69ada98099a23c32a06d3e75078d6ffc Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 8 Sep 2019 18:43:47 -0400 Subject: [PATCH] Fixed #2496 --- .../plotsquared/bukkit/util/BukkitUtil.java | 5 +++++ .../plotsquared/plot/PlotVersionTest.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index a2d0b0c9b..ebf67e075 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -22,6 +22,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.block.data.Directional; +import org.bukkit.block.data.type.WallSign; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; @@ -359,6 +360,10 @@ import java.util.Set; } else { block.setType(Material.valueOf("OAK_WALL_SIGN"), false); } + if (!(block.getBlockData() instanceof WallSign)) { + PlotSquared.debug(block.getBlockData().getAsString()); + throw new RuntimeException("Something went wrong generating a sign"); + } final Directional sign = (Directional) block.getBlockData(); sign.setFacing(facing); block.setBlockData(sign, false); diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java new file mode 100644 index 000000000..069c886da --- /dev/null +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/PlotVersionTest.java @@ -0,0 +1,13 @@ +package com.github.intellectualsites.plotsquared.plot; + +import org.junit.Test; + +public class PlotVersionTest { + + @Test public void tryParse() { + //These are all random values chosen to form the test class. + PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05"); + System.out.println(version.build); + + } +}