mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-31 21:07:47 +01:00
Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
commit
e21515bda5
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.9.4"
|
||||
version: "1.9.5"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -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;
|
||||
|
@ -88,13 +88,24 @@ public class Methods {
|
||||
|| !blacklist.isEmpty() && blacklist.contains(type.name());
|
||||
}
|
||||
|
||||
public static boolean isMaterialBlacklisted(Material type, byte data) {
|
||||
List<String> whitelist = Setting.ITEM_WHITELIST.getStringList();
|
||||
List<String> 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));
|
||||
|
Loading…
Reference in New Issue
Block a user