From 10754f8119d78612b3c978417a662e95d1a16248 Mon Sep 17 00:00:00 2001 From: Stijn Bannink Date: Thu, 12 Oct 2023 20:37:53 +0200 Subject: [PATCH] Bumped to v3.2.3 --- pom.xml | 2 +- .../themeparkplus/util/LGUtil.java | 30 +++++++++---------- src/main/resources/config.yml | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index fa26ca7..4190310 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ nl.SBDeveloper ThemeParkPlus - 3.2.1 + 3.2.3 jar ThemeParkPlus diff --git a/src/main/java/nl/sbdeveloper/themeparkplus/util/LGUtil.java b/src/main/java/nl/sbdeveloper/themeparkplus/util/LGUtil.java index cbd4d16..096fa09 100644 --- a/src/main/java/nl/sbdeveloper/themeparkplus/util/LGUtil.java +++ b/src/main/java/nl/sbdeveloper/themeparkplus/util/LGUtil.java @@ -1,31 +1,33 @@ package nl.sbdeveloper.themeparkplus.util; -import com.cryptomorin.xseries.XMaterial; -import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Lightable; import org.bukkit.block.data.Openable; import org.jetbrains.annotations.NotNull; public class LGUtil { - private static final BlockData lampAanData = Bukkit.createBlockData(XMaterial.REDSTONE_LAMP.parseMaterial(), "lit=true"); - private static final BlockData lampUitData = Bukkit.createBlockData(XMaterial.REDSTONE_LAMP.parseMaterial(), "lit=false"); - private LGUtil() {} public static boolean zetLampAan(Block lampBlock) { - if ((isLamp(lampBlock)) && (!isAan(lampBlock))) { - lampBlock.setBlockData(lampAanData); + if (isLamp(lampBlock)) { + Lightable lb = (Lightable) lampBlock.getBlockData(); + if (lb.isLit()) return false; + lb.setLit(true); + lampBlock.setBlockData(lb); return true; } return false; } public static boolean zetLampUit(Block lampBlock) { - if ((isLamp(lampBlock)) && (isAan(lampBlock))) { - lampBlock.setBlockData(lampUitData); + if (isLamp(lampBlock)) { + Lightable lb = (Lightable) lampBlock.getBlockData(); + if (!lb.isLit()) return false; + lb.setLit(false); + lampBlock.setBlockData(lb); return true; } return false; @@ -84,14 +86,10 @@ public class LGUtil { } public static boolean isOpenable(@NotNull Block b) { - return b.getBlockData() instanceof org.bukkit.block.data.Openable; + return b.getBlockData() instanceof Openable; } - private static boolean isAan(Block lamp) { - return lamp.getBlockData().getAsString().contains("lit=true"); - } - - private static boolean isLamp(Block lamp) { - return lamp.getType() == XMaterial.REDSTONE_LAMP.parseMaterial(); + private static boolean isLamp(Block b) { + return b.getBlockData() instanceof Lightable; } } \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 9ce6acd..09b956f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -56,7 +56,7 @@ DiscordWebhook: WebhookURL: "" Embed: Title: "%RideName% - Status change" - Copyright: "Copyright ThemePark 2020" + Copyright: "Copyright ThemePark 2023" CopyrightImage: "https://www.spigotmc.org/data/resource_icons/48/48648.jpg?1544984106" Colors: OPEN: 0x55FF55