Skip to content

Commit

Permalink
Added version check when building list of items
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamikaschu committed Dec 3, 2023
1 parent 8841c3d commit 75f3d3a
Showing 1 changed file with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,32 @@ public class PlayerEventListener implements Listener {
Material.WRITABLE_BOOK,
Material.WRITTEN_BOOK
);
private static final Set<Material> DYES = Set.of(
Material.WHITE_DYE,
Material.LIGHT_GRAY_DYE,
Material.GRAY_DYE,
Material.BLACK_DYE,
Material.BROWN_DYE,
Material.RED_DYE,
Material.ORANGE_DYE,
Material.YELLOW_DYE,
Material.LIME_DYE,
Material.GREEN_DYE,
Material.CYAN_DYE,
Material.LIGHT_BLUE_DYE,
Material.BLUE_DYE,
Material.PURPLE_DYE,
Material.MAGENTA_DYE,
Material.PINK_DYE,
Material.GLOW_INK_SAC,
Material.HONEYCOMB
);
private final Set<String> DYES;
{
DYES = new HashSet<>(Set.of(
"WHITE_DYE",
"LIGHT_GRAY_DYE",
"GRAY_DYE",
"BLACK_DYE",
"BROWN_DYE",
"RED_DYE",
"ORANGE_DYE",
"YELLOW_DYE",
"LIME_DYE",
"GREEN_DYE",
"CYAN_DYE",
"LIGHT_BLUE_DYE",
"BLUE_DYE",
"PURPLE_DYE",
"MAGENTA_DYE",
"PINK_DYE",
"GLOW_INK_SAC"
));
int[] version = PlotSquared.platform().serverVersion();
if (version[1] >= 20 && version[2] >= 1) {
DYES.add("HONEYCOMB");
}
}
private final EventDispatcher eventDispatcher;
private final WorldEdit worldEdit;
private final PlotAreaManager plotAreaManager;
Expand Down Expand Up @@ -237,7 +243,7 @@ public void onPlayerDyeSign(PlayerInteractEvent event) {
}
Block block = event.getClickedBlock();
if (block != null && block.getState() instanceof Sign) {
if (DYES.contains(itemStack.getType())) {
if (DYES.contains(itemStack.getType().toString())) {
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
Expand Down

0 comments on commit 75f3d3a

Please sign in to comment.