From fa8c07884cbddcb09552731f7e09cc99265a83f5 Mon Sep 17 00:00:00 2001 From: DNx Date: Fri, 10 Apr 2020 04:40:38 +0700 Subject: [PATCH] fix 1.13 compatibility --- pom.xml | 2 +- .../slimefun4/utils/BlockUtils.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 0e775628c..321b0314d 100644 --- a/pom.xml +++ b/pom.xml @@ -216,7 +216,7 @@ com.github.thebusybiscuit CS-CoreLib2 - 0.12 + 0b974b0 compile diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/BlockUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/BlockUtils.java index 89941ca73..2d051fdee 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/BlockUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/BlockUtils.java @@ -1,13 +1,18 @@ package io.github.thebusybiscuit.slimefun4.utils; +import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils; +import org.bukkit.Material; import org.bukkit.block.Block; public final class BlockUtils { + private static final boolean is_1_14 = ReflectionUtils.isVersion("v1_14_"); + private BlockUtils() {} public static boolean hasInventory(Block block) { if (block == null) return false; - switch (block.getType()) { + Material type = block.getType(); + switch (type) { case CHEST: case TRAPPED_CHEST: case FURNACE: @@ -16,13 +21,12 @@ public final class BlockUtils { case HOPPER: case BREWING_STAND: case ENDER_CHEST: - case BARREL: - case BLAST_FURNACE: - case LECTERN: - case SMOKER: return true; default: - return block.getType().name().endsWith("SHULKER_BOX"); + if (type.name().endsWith("SHULKER_BOX")) return true; + + return (is_1_14 && + (type == Material.BARREL || type == Material.BLAST_FURNACE || type == Material.LECTERN || type == Material.SMOKER)); } } }