diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ac8621..76f1fed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "UltimateStacker" path: "/builds/$CI_PROJECT_PATH" - version: "1.9.4" + version: "1.9.5" build: stage: build diff --git a/src/main/java/com/songoda/ultimatestacker/listeners/ItemListeners.java b/src/main/java/com/songoda/ultimatestacker/listeners/ItemListeners.java index df0b0d0..ea4d557 100644 --- a/src/main/java/com/songoda/ultimatestacker/listeners/ItemListeners.java +++ b/src/main/java/com/songoda/ultimatestacker/listeners/ItemListeners.java @@ -6,6 +6,7 @@ import com.songoda.ultimatestacker.utils.ServerVersion; import com.songoda.ultimatestacker.utils.settings.Setting; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; +import org.bukkit.Server; import org.bukkit.Sound; import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; @@ -41,7 +42,10 @@ public class ItemListeners implements Listener { int specific = instance.getItemFile().getConfig().getInt("Items." + itemStack.getType().name() + ".Max Stack Size"); int max = specific == -1 && new ItemStack(itemStack.getType()).getMaxStackSize() != 1 ? maxItemStackSize : specific; - if (Methods.isMaterialBlacklisted(itemStack.getType())) + if (instance.isServerVersionAtLeast(ServerVersion.V1_13) && Methods.isMaterialBlacklisted(itemStack.getType())) + max = new ItemStack(itemStack.getType()).getMaxStackSize(); + + if (!instance.isServerVersionAtLeast(ServerVersion.V1_13) && Methods.isMaterialBlacklisted(itemStack.getType(), itemStack.getData().getData())) max = new ItemStack(itemStack.getType()).getMaxStackSize(); if (max == -1) max = 1; diff --git a/src/main/java/com/songoda/ultimatestacker/utils/Methods.java b/src/main/java/com/songoda/ultimatestacker/utils/Methods.java index 9a883b2..34bf22b 100644 --- a/src/main/java/com/songoda/ultimatestacker/utils/Methods.java +++ b/src/main/java/com/songoda/ultimatestacker/utils/Methods.java @@ -88,13 +88,24 @@ public class Methods { || !blacklist.isEmpty() && blacklist.contains(type.name()); } + public static boolean isMaterialBlacklisted(Material type, byte data) { + List whitelist = Setting.ITEM_WHITELIST.getStringList(); + List blacklist = Setting.ITEM_BLACKLIST.getStringList(); + + String combined = type.toString() + ":" + data; + + return !whitelist.isEmpty() && !whitelist.contains(combined) + || !blacklist.isEmpty() && blacklist.contains(combined); + } + public static void updateItemAmount(Item item, ItemStack itemStack, int newAmount) { UltimateStacker plugin = UltimateStacker.getInstance(); Material material = itemStack.getType(); String name = Methods.convertToInvisibleString("IS") + compileItemName(itemStack, newAmount); - boolean blacklisted = isMaterialBlacklisted(itemStack.getType()); + boolean blacklisted = UltimateStacker.getInstance().isServerVersionAtLeast(ServerVersion.V1_13) ? + isMaterialBlacklisted(itemStack.getType()) : isMaterialBlacklisted(itemStack.getType(), itemStack.getData().getData()); if (newAmount > 32 && !blacklisted) { item.setMetadata("US_AMT", new FixedMetadataValue(plugin, newAmount));