3.6.2
- gui now configurable per rank - fix item requirement
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
package sh.okx.rankup.util;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
import java.util.function.Supplier;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class ItemUtil {
|
||||
private static Supplier<Boolean> flattenedSupplier = Suppliers.memoize(ItemUtil::isServerFlattenedPrivate);
|
||||
private static boolean flattened;
|
||||
|
||||
private static boolean isServerFlattenedPrivate() {
|
||||
static {
|
||||
try {
|
||||
Material.valueOf("BLACK_STAINED_GLASS_PANE");
|
||||
return true;
|
||||
flattened = true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
flattened = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a server is post-flattening or pre-flattening.
|
||||
* The flattening is the name for a process where, instead of using durability to represent
|
||||
* The flattening is the name for the event where, instead of using durability to represent
|
||||
* similar items, Mojang decided to use distinct item types for each item.
|
||||
* This caused many {@link Material} names to change, making some things incompatible.
|
||||
* The flattening happened in 1.13.
|
||||
@@ -26,6 +24,6 @@ public class ItemUtil {
|
||||
* @return true if the server is post-flattening (server versions 1.13, 1.14, 1.15) or false if it is pre-flattening (1.12, 1.11, 1.10 etc)
|
||||
*/
|
||||
public static boolean isServerFlattened() {
|
||||
return flattenedSupplier.get();
|
||||
return flattened;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user