3
0
Fork 0

Bumped to v3.2.3
All checks were successful
Plugins/ThemeParkPlus/pipeline/head This commit looks good

This commit is contained in:
Stijn Bannink 2023-10-12 20:37:53 +02:00
parent d71f9a0fca
commit 10754f8119
3 changed files with 16 additions and 18 deletions

View file

@ -6,7 +6,7 @@
<groupId>nl.SBDeveloper</groupId> <groupId>nl.SBDeveloper</groupId>
<artifactId>ThemeParkPlus</artifactId> <artifactId>ThemeParkPlus</artifactId>
<version>3.2.1</version> <version>3.2.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ThemeParkPlus</name> <name>ThemeParkPlus</name>

View file

@ -1,31 +1,33 @@
package nl.sbdeveloper.themeparkplus.util; package nl.sbdeveloper.themeparkplus.util;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional; import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Lightable;
import org.bukkit.block.data.Openable; import org.bukkit.block.data.Openable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class LGUtil { 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() {} private LGUtil() {}
public static boolean zetLampAan(Block lampBlock) { public static boolean zetLampAan(Block lampBlock) {
if ((isLamp(lampBlock)) && (!isAan(lampBlock))) { if (isLamp(lampBlock)) {
lampBlock.setBlockData(lampAanData); Lightable lb = (Lightable) lampBlock.getBlockData();
if (lb.isLit()) return false;
lb.setLit(true);
lampBlock.setBlockData(lb);
return true; return true;
} }
return false; return false;
} }
public static boolean zetLampUit(Block lampBlock) { public static boolean zetLampUit(Block lampBlock) {
if ((isLamp(lampBlock)) && (isAan(lampBlock))) { if (isLamp(lampBlock)) {
lampBlock.setBlockData(lampUitData); Lightable lb = (Lightable) lampBlock.getBlockData();
if (!lb.isLit()) return false;
lb.setLit(false);
lampBlock.setBlockData(lb);
return true; return true;
} }
return false; return false;
@ -84,14 +86,10 @@ public class LGUtil {
} }
public static boolean isOpenable(@NotNull Block b) { 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) { private static boolean isLamp(Block b) {
return lamp.getBlockData().getAsString().contains("lit=true"); return b.getBlockData() instanceof Lightable;
}
private static boolean isLamp(Block lamp) {
return lamp.getType() == XMaterial.REDSTONE_LAMP.parseMaterial();
} }
} }

View file

@ -56,7 +56,7 @@ DiscordWebhook:
WebhookURL: "" WebhookURL: ""
Embed: Embed:
Title: "%RideName% - Status change" Title: "%RideName% - Status change"
Copyright: "Copyright ThemePark 2020" Copyright: "Copyright ThemePark 2023"
CopyrightImage: "https://www.spigotmc.org/data/resource_icons/48/48648.jpg?1544984106" CopyrightImage: "https://www.spigotmc.org/data/resource_icons/48/48648.jpg?1544984106"
Colors: Colors:
OPEN: 0x55FF55 OPEN: 0x55FF55