mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
fix 1.13 compatibility
This commit is contained in:
parent
9eb3ee2d53
commit
fa8c07884c
2
pom.xml
2
pom.xml
@ -216,7 +216,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.thebusybiscuit</groupId>
|
||||
<artifactId>CS-CoreLib2</artifactId>
|
||||
<version>0.12</version>
|
||||
<version>0b974b0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user