Updates to Xmaterial

This commit is contained in:
ceze88 2023-06-29 11:18:18 +02:00
parent 62e232b09e
commit abd41fc602
16 changed files with 223 additions and 205 deletions

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker; package com.craftaro.ultimatestacker;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI; import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.stack.block.BlockStack; import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager; import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
@ -72,6 +73,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.Set; import java.util.Set;
public class UltimateStacker extends SongodaPlugin { public class UltimateStacker extends SongodaPlugin {
@ -122,7 +124,7 @@ public class UltimateStacker extends SongodaPlugin {
public void onPluginEnable() { public void onPluginEnable() {
// Run Songoda Updater // Run Songoda Updater
Async.start(); Async.start();
SongodaCore.registerPlugin(this, 16, CompatibleMaterial.IRON_INGOT); SongodaCore.registerPlugin(this, 16, XMaterial.IRON_INGOT);
// Setup Config // Setup Config
Settings.setupConfig(); Settings.setupConfig();
this.setLocale(Settings.LANGUGE_MODE.getString(), false); this.setLocale(Settings.LANGUGE_MODE.getString(), false);
@ -382,16 +384,11 @@ public class UltimateStacker extends SongodaPlugin {
* @return true if this material will not stack * @return true if this material will not stack
*/ */
public static boolean isMaterialBlacklisted(ItemStack item) { public static boolean isMaterialBlacklisted(ItemStack item) {
CompatibleMaterial mat = CompatibleMaterial.getMaterial(item); Optional<XMaterial> mat = XMaterial.matchXMaterial(item.getType().name());
if (mat == null) {
// this shouldn't happen, but just in case? // this shouldn't happen, but just in case?
return item == null ? false : (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) return mat.map(xMaterial -> isMaterialBlacklisted(xMaterial.name()) || isMaterialBlacklisted(xMaterial.parseMaterial()))
? isMaterialBlacklisted(item.getType()) : isMaterialBlacklisted(item.getType(), item.getData().getData())); .orElseGet(() -> ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) ?
} else if (mat.usesData()) { isMaterialBlacklisted(item.getType()) : isMaterialBlacklisted(item.getType(), item.getData().getData()));
return isMaterialBlacklisted(mat.name()) || isMaterialBlacklisted(mat.getMaterial(), mat.getData());
} else {
return isMaterialBlacklisted(mat.name()) || isMaterialBlacklisted(mat.getMaterial());
}
} }
/** /**

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.gui; package com.craftaro.ultimatestacker.gui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.convert.StackMobConvert; import com.craftaro.ultimatestacker.convert.StackMobConvert;
import com.craftaro.ultimatestacker.convert.WildStackerConvert; import com.craftaro.ultimatestacker.convert.WildStackerConvert;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
@ -15,12 +16,12 @@ public class GUIConvert extends Gui {
setRows(1); setRows(1);
int current = 0; int current = 0;
if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) { if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) {
this.setButton(current++, GuiUtils.createButtonItem(CompatibleMaterial.STONE, ChatColor.GRAY + "WildStacker"), this.setButton(current++, GuiUtils.createButtonItem(XMaterial.STONE, ChatColor.GRAY + "WildStacker"),
(event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new WildStackerConvert(), this))); (event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new WildStackerConvert(), this)));
} }
if (Bukkit.getPluginManager().isPluginEnabled("StackMob")) { if (Bukkit.getPluginManager().isPluginEnabled("StackMob")) {
this.setButton(current++, GuiUtils.createButtonItem(CompatibleMaterial.STONE, ChatColor.GRAY + "StackMob"), this.setButton(current++, GuiUtils.createButtonItem(XMaterial.STONE, ChatColor.GRAY + "StackMob"),
(event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new StackMobConvert(), this))); (event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new StackMobConvert(), this)));
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.gui; package com.craftaro.ultimatestacker.gui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.convert.Convert; import com.craftaro.ultimatestacker.convert.Convert;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui; import com.craftaro.core.gui.Gui;
@ -22,20 +23,20 @@ public class GUIConvertWhat extends Gui {
this.convertFrom = convertFrom; this.convertFrom = convertFrom;
if (convertFrom.canEntities()) { if (convertFrom.canEntities()) {
this.setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.STONE, this.setButton(0, GuiUtils.createButtonItem(XMaterial.STONE,
ChatColor.GRAY + "Stacked Entities", ChatColor.GRAY + "Stacked Entities",
entities ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"), entities ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"),
(event) -> toggleEntities()); (event) -> toggleEntities());
} }
if (convertFrom.canSpawners()) { if (convertFrom.canSpawners()) {
this.setButton(1, GuiUtils.createButtonItem(CompatibleMaterial.STONE, this.setButton(1, GuiUtils.createButtonItem(XMaterial.STONE,
ChatColor.GRAY + "Stacked Spawners", ChatColor.GRAY + "Stacked Spawners",
spawners ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"), spawners ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"),
(event) -> toggleSpawners()); (event) -> toggleSpawners());
} }
this.setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_WOOL, ChatColor.GREEN + "Run"), this.setButton(8, GuiUtils.createButtonItem(XMaterial.GREEN_WOOL, ChatColor.GREEN + "Run"),
(event) -> run(event.player)); (event) -> run(event.player));
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.listeners; package com.craftaro.ultimatestacker.listeners;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI; import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.events.spawner.SpawnerBreakEvent; import com.craftaro.ultimatestacker.api.events.spawner.SpawnerBreakEvent;
@ -35,6 +36,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta; import org.bukkit.inventory.meta.BlockStateMeta;
import java.util.List; import java.util.List;
import java.util.Optional;
public class BlockListeners implements Listener { public class BlockListeners implements Listener {
@ -67,11 +69,13 @@ public class BlockListeners implements Listener {
//Stacking blocks //Stacking blocks
if (Settings.STACK_BLOCKS.getBoolean() if (Settings.STACK_BLOCKS.getBoolean()
&& Settings.STACKABLE_BLOCKS.getStringList().contains(block.getType().name()) //Is block stackable && Settings.STACKABLE_BLOCKS.getStringList().contains(block.getType().name()) //Is block stackable
&& !block.getType().equals(CompatibleMaterial.SPAWNER.getMaterial()) //Don't stack spawners here && !block.getType().equals(XMaterial.SPAWNER.parseMaterial()) //Don't stack spawners here
) { ) {
CompatibleMaterial blockType = CompatibleMaterial.getMaterial(block); Optional<XMaterial> xBlockType = XMaterial.matchXMaterial(block.getType().name());
if (blockType == null) return; if (!xBlockType.isPresent()) return;
XMaterial blockType = xBlockType.get();
BlockStackManager blockStackManager = plugin.getBlockStackManager(); BlockStackManager blockStackManager = plugin.getBlockStackManager();
boolean isStacked = blockStackManager.isBlock(block.getLocation()); boolean isStacked = blockStackManager.isBlock(block.getLocation());
@ -83,7 +87,7 @@ public class BlockListeners implements Listener {
//Add to stack //Add to stack
if (clickAction == Action.RIGHT_CLICK_BLOCK) { if (clickAction == Action.RIGHT_CLICK_BLOCK) {
if (inHand.getType().equals(Material.AIR)) return; if (inHand.getType().equals(Material.AIR)) return;
if(!blockType.equals(CompatibleMaterial.getMaterial(inHand))) return; if(!blockType.equals(XMaterial.matchXMaterial(inHand))) return;
//Add all held items to stack //Add all held items to stack
if (Settings.ALWAYS_ADD_ALL.getBoolean() || isSneaking) { if (Settings.ALWAYS_ADD_ALL.getBoolean() || isSneaking) {
stack.add(inHandAmount); stack.add(inHandAmount);
@ -104,7 +108,7 @@ public class BlockListeners implements Listener {
if (isSneaking) { if (isSneaking) {
//Remove all items from stack //Remove all items from stack
int amountToRemove = Math.min(Settings.MAX_REMOVEABLE.getInt(), stack.getAmount()); int amountToRemove = Math.min(Settings.MAX_REMOVEABLE.getInt(), stack.getAmount());
ItemStack removed = stack.getMaterial().getItem(); ItemStack removed = stack.getMaterial().parseItem();
removed.setAmount(amountToRemove); removed.setAmount(amountToRemove);
stack.take(amountToRemove); stack.take(amountToRemove);
if (Settings.ADD_TO_INVENTORY.getBoolean()) { if (Settings.ADD_TO_INVENTORY.getBoolean()) {
@ -116,9 +120,9 @@ public class BlockListeners implements Listener {
//Remove one item from stack //Remove one item from stack
stack.take(1); stack.take(1);
if (Settings.ADD_TO_INVENTORY.getBoolean()) { if (Settings.ADD_TO_INVENTORY.getBoolean()) {
player.getInventory().addItem(stack.getMaterial().getItem()); player.getInventory().addItem(stack.getMaterial().parseItem());
} else { } else {
player.getWorld().dropItemNaturally(block.getLocation(), stack.getMaterial().getItem()); player.getWorld().dropItemNaturally(block.getLocation(), stack.getMaterial().parseItem());
} }
} }
if (stack.getAmount() == 0) { if (stack.getAmount() == 0) {
@ -135,7 +139,7 @@ public class BlockListeners implements Listener {
if (isSneaking) return; if (isSneaking) return;
//Check if player clicked the same type as the clicked block //Check if player clicked the same type as the clicked block
if (inHand.getType().equals(Material.AIR)) return; if (inHand.getType().equals(Material.AIR)) return;
if(!blockType.equals(CompatibleMaterial.getMaterial(inHand))) return; if(!blockType.equals(XMaterial.matchXMaterial(inHand))) return;
if (clickAction != Action.RIGHT_CLICK_BLOCK) return; if (clickAction != Action.RIGHT_CLICK_BLOCK) return;
//Create new stack //Create new stack
event.setCancelled(true); event.setCancelled(true);
@ -150,8 +154,8 @@ public class BlockListeners implements Listener {
} }
//Stacking spawners //Stacking spawners
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial() if (block.getType() != XMaterial.SPAWNER.parseMaterial()
|| inHand.getType() != CompatibleMaterial.SPAWNER.getMaterial() || inHand.getType() != XMaterial.SPAWNER.parseMaterial()
|| event.getAction() == Action.LEFT_CLICK_BLOCK) return; || event.getAction() == Action.LEFT_CLICK_BLOCK) return;
List<String> disabledWorlds = Settings.DISABLED_WORLDS.getStringList(); List<String> disabledWorlds = Settings.DISABLED_WORLDS.getStringList();
@ -215,7 +219,7 @@ public class BlockListeners implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial() if (block.getType() != XMaterial.SPAWNER.parseMaterial()
|| !(block.getState() instanceof CreatureSpawner) // Needed for a DataPack || !(block.getState() instanceof CreatureSpawner) // Needed for a DataPack
|| !plugin.spawnersEnabled()) || !plugin.spawnersEnabled())
return; return;
@ -244,7 +248,7 @@ public class BlockListeners implements Listener {
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
if (event.isCancelled()) return; if (event.isCancelled()) return;
Block block = event.getBlock(); Block block = event.getBlock();
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return; if (block.getType() != XMaterial.SPAWNER.parseMaterial()) return;
if (!plugin.spawnersEnabled()) return; if (!plugin.spawnersEnabled()) return;
event.setExpToDrop(0); event.setExpToDrop(0);

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.listeners; package com.craftaro.ultimatestacker.listeners;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack; import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
import com.craftaro.ultimatestacker.settings.Settings; import com.craftaro.ultimatestacker.settings.Settings;
@ -83,27 +84,27 @@ public class InteractListeners implements Listener {
case "PIG": case "PIG":
return type == Material.CARROT || (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) && type == Material.BEETROOT) || type == Material.POTATO; return type == Material.CARROT || (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) && type == Material.BEETROOT) || type == Material.POTATO;
case "CHICKEN": case "CHICKEN":
return type == CompatibleMaterial.WHEAT_SEEDS.getMaterial() return type == XMaterial.WHEAT_SEEDS.parseMaterial()
|| type == Material.MELON_SEEDS || type == Material.MELON_SEEDS
|| type == Material.PUMPKIN_SEEDS || type == Material.PUMPKIN_SEEDS
|| type == CompatibleMaterial.BEETROOT_SEEDS.getMaterial(); || type == XMaterial.BEETROOT_SEEDS.parseMaterial();
case "HORSE": case "HORSE":
return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed(); return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed();
case "WOLF": case "WOLF":
return type == CompatibleMaterial.BEEF.getMaterial() return type == XMaterial.BEEF.parseMaterial()
|| type == CompatibleMaterial.CHICKEN.getMaterial() || type == XMaterial.CHICKEN.parseMaterial()
|| type == CompatibleMaterial.COD.getMaterial() || type == XMaterial.COD.parseMaterial()
|| type == CompatibleMaterial.MUTTON.getMaterial() || type == XMaterial.MUTTON.parseMaterial()
|| type == CompatibleMaterial.PORKCHOP.getMaterial() || type == XMaterial.PORKCHOP.parseMaterial()
|| type == CompatibleMaterial.RABBIT.getMaterial() || type == XMaterial.RABBIT.parseMaterial()
|| CompatibleMaterial.SALMON.matches(is) || XMaterial.SALMON.equals(XMaterial.matchXMaterial(is))
|| type == CompatibleMaterial.COOKED_BEEF.getMaterial() || type == XMaterial.COOKED_BEEF.parseMaterial()
|| type == CompatibleMaterial.COOKED_CHICKEN.getMaterial() || type == XMaterial.COOKED_CHICKEN.parseMaterial()
|| type == CompatibleMaterial.COOKED_COD.getMaterial() || type == XMaterial.COOKED_COD.parseMaterial()
|| type == CompatibleMaterial.COOKED_MUTTON.getMaterial() || type == XMaterial.COOKED_MUTTON.parseMaterial()
|| type == CompatibleMaterial.COOKED_PORKCHOP.getMaterial() || type == XMaterial.COOKED_PORKCHOP.parseMaterial()
|| type == CompatibleMaterial.COOKED_RABBIT.getMaterial() || type == XMaterial.COOKED_RABBIT.parseMaterial()
|| CompatibleMaterial.COOKED_SALMON.matches(is) || XMaterial.COOKED_SALMON.equals(XMaterial.matchXMaterial(is))
&& ((Wolf) entity).isTamed(); && ((Wolf) entity).isTamed();
case "OCELOT": case "OCELOT":
return (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) return (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
@ -111,7 +112,7 @@ public class InteractListeners implements Listener {
|| type == Material.COD || type == Material.COD
|| type == Material.PUFFERFISH || type == Material.PUFFERFISH
|| type == Material.TROPICAL_FISH || type == Material.TROPICAL_FISH
: type == CompatibleMaterial.COD.getMaterial()); // Now broken in 1.13 ((Ocelot) entity).isTamed() : type == XMaterial.COD.parseMaterial()); // Now broken in 1.13 ((Ocelot) entity).isTamed()
case "PANDA": case "PANDA":
return (type == Material.BAMBOO); return (type == Material.BAMBOO);
case "FOX": case "FOX":

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.listeners; package com.craftaro.ultimatestacker.listeners;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack; import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager; import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
@ -88,17 +89,17 @@ public class ShearListeners implements Listener {
switch (entity.getType()) { switch (entity.getType()) {
case SHEEP: case SHEEP:
itemStack = new ItemStack(CompatibleMaterial.WHITE_WOOL.getMaterial()); itemStack = new ItemStack(XMaterial.WHITE_WOOL.parseMaterial());
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13))
itemStack.setType(Material.valueOf(((Sheep) entity).getColor() + "_WOOL")); itemStack.setType(Material.valueOf(((Sheep) entity).getColor() + "_WOOL"));
else else
itemStack.setDurability((short) ((Sheep) entity).getColor().getWoolData()); itemStack.setDurability((short) ((Sheep) entity).getColor().getWoolData());
break; break;
case MUSHROOM_COW: case MUSHROOM_COW:
itemStack = new ItemStack(CompatibleMaterial.RED_MUSHROOM.getMaterial(), 5); itemStack = new ItemStack(XMaterial.RED_MUSHROOM.parseMaterial(), 5);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)
&& ((MushroomCow) entity).getVariant() == MushroomCow.Variant.BROWN) && ((MushroomCow) entity).getVariant() == MushroomCow.Variant.BROWN)
itemStack.setType(CompatibleMaterial.BROWN_MUSHROOM.getMaterial()); itemStack.setType(XMaterial.BROWN_MUSHROOM.parseMaterial());
break; break;
} }
return itemStack; return itemStack;

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.listeners.entity; package com.craftaro.ultimatestacker.listeners.entity;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI; import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack; import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
@ -114,7 +115,7 @@ public class EntityListeners implements Listener {
List<Block> toCancel = new ArrayList<>(); List<Block> toCancel = new ArrayList<>();
while (it.hasNext()) { while (it.hasNext()) {
Block block = it.next(); Block block = it.next();
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) if (block.getType() != XMaterial.SPAWNER.parseMaterial())
continue; continue;
Location spawnLocation = block.getLocation(); Location spawnLocation = block.getLocation();

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.lootables; package com.craftaro.ultimatestacker.lootables;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.settings.Settings; import com.craftaro.ultimatestacker.settings.Settings;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
@ -66,11 +67,11 @@ public class LootablesManager {
Modify modify = null; Modify modify = null;
if (entity instanceof Sheep) { if (entity instanceof Sheep) {
modify = (Loot loot2) -> { modify = (Loot loot2) -> {
CompatibleMaterial material = loot2.getMaterial(); XMaterial material = loot2.getMaterial();
if (material != null && material.name().contains("WOOL") && ((Sheep) entity).getColor() != null) { if (material != null && material.name().contains("WOOL") && ((Sheep) entity).getColor() != null) {
if (((Sheep) entity).isSheared()) return null; if (((Sheep) entity).isSheared()) return null;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13))
loot2.setMaterial(CompatibleMaterial.valueOf(((Sheep) entity).getColor() + "_WOOL")); loot2.setMaterial(XMaterial.valueOf(((Sheep) entity).getColor() + "_WOOL"));
} }
return loot2; return loot2;
@ -137,8 +138,8 @@ public class LootablesManager {
if (amount > 0) { if (amount > 0) {
ItemStack item = entity.getFireTicks() > 0 ItemStack item = entity.getFireTicks() > 0
? loot.getBurnedMaterial() != null ? loot.getBurnedMaterial().getItem() : loot.getMaterial().getItem() ? loot.getBurnedMaterial() != null ? loot.getBurnedMaterial().parseItem() : loot.getMaterial().parseItem()
: loot.getMaterial().getItem().clone(); : loot.getMaterial().parseItem().clone();
item.setAmount(amount); item.setAmount(amount);
toDrop.add(new Drop(item)); toDrop.add(new Drop(item));
} }
@ -159,8 +160,8 @@ public class LootablesManager {
if (amount > 0) { if (amount > 0) {
ItemStack item = entity.getFireTicks() > 0 ItemStack item = entity.getFireTicks() > 0
? child.getBurnedMaterial() != null ? child.getBurnedMaterial().getItem() : child.getMaterial().getItem() ? child.getBurnedMaterial() != null ? child.getBurnedMaterial().parseItem() : child.getMaterial().parseItem()
: child.getMaterial().getItem().clone(); : child.getMaterial().parseItem().clone();
item.setAmount(amount); item.setAmount(amount);
toDrop.add(new Drop(item)); toDrop.add(new Drop(item));
} }
@ -179,14 +180,14 @@ public class LootablesManager {
// Add Glow Squid. // Add Glow Squid.
lootManager.addLootable(new Lootable("GLOW_SQUID", lootManager.addLootable(new Lootable("GLOW_SQUID",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GLOW_INK_SAC) .setMaterial(XMaterial.GLOW_INK_SAC)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
// Add Glow Squid. // Add Glow Squid.
lootManager.addLootable(new Lootable("SQUID", lootManager.addLootable(new Lootable("SQUID",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GLOW_INK_SAC) .setMaterial(XMaterial.GLOW_INK_SAC)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
} }
@ -194,31 +195,31 @@ public class LootablesManager {
// Add Trader Llama. // Add Trader Llama.
lootManager.addLootable(new Lootable("TRADER_LLAMA", lootManager.addLootable(new Lootable("TRADER_LLAMA",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Pillager. // Add Pillager.
lootManager.addLootable(new Lootable("PILLAGER", lootManager.addLootable(new Lootable("PILLAGER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ARROW) .setMaterial(XMaterial.ARROW)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Ravager. // Add Ravager.
lootManager.addLootable(new Lootable("RAVAGER", lootManager.addLootable(new Lootable("RAVAGER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SADDLE).build())); .setMaterial(XMaterial.SADDLE).build()));
// Add Cat. // Add Cat.
lootManager.addLootable(new Lootable("CAT", lootManager.addLootable(new Lootable("CAT",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.STRING).build())); .setMaterial(XMaterial.STRING).build()));
// Add Panda. // Add Panda.
lootManager.addLootable(new Lootable("PANDA", lootManager.addLootable(new Lootable("PANDA",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BAMBOO) .setMaterial(XMaterial.BAMBOO)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
} }
@ -228,7 +229,7 @@ public class LootablesManager {
// Add Phantom. // Add Phantom.
lootManager.addLootable(new Lootable("PHANTOM", lootManager.addLootable(new Lootable("PHANTOM",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PHANTOM_MEMBRANE) .setMaterial(XMaterial.PHANTOM_MEMBRANE)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -236,29 +237,29 @@ public class LootablesManager {
// Add Pufferfish. // Add Pufferfish.
lootManager.addLootable(new Lootable("PUFFERFISH", lootManager.addLootable(new Lootable("PUFFERFISH",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PUFFERFISH).build(), .setMaterial(XMaterial.PUFFERFISH).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE_MEAL) .setMaterial(XMaterial.BONE_MEAL)
.setChance(5).build())); .setChance(5).build()));
// Add Salmon. // Add Salmon.
lootManager.addLootable(new Lootable("SALMON", lootManager.addLootable(new Lootable("SALMON",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON) .setMaterial(XMaterial.SALMON)
.setBurnedMaterial(CompatibleMaterial.COOKED_SALMON).build(), .setBurnedMaterial(XMaterial.COOKED_SALMON).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE_MEAL) .setMaterial(XMaterial.BONE_MEAL)
.setChance(5).build())); .setChance(5).build()));
// Add Tropical Fish. // Add Tropical Fish.
lootManager.addLootable(new Lootable("TROPICAL_FISH", lootManager.addLootable(new Lootable("TROPICAL_FISH",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.TROPICAL_FISH).build(), .setMaterial(XMaterial.TROPICAL_FISH).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE_MEAL) .setMaterial(XMaterial.BONE_MEAL)
.setChance(5).build(), .setChance(5).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE) .setMaterial(XMaterial.BONE)
.setMin(1) .setMin(1)
.setMax(2) .setMax(2)
.setChance(25) .setChance(25)
@ -267,35 +268,35 @@ public class LootablesManager {
// Add Dolphin. // Add Dolphin.
lootManager.addLootable(new Lootable("DOLPHIN", lootManager.addLootable(new Lootable("DOLPHIN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setBurnedMaterial(CompatibleMaterial.COOKED_COD) .setBurnedMaterial(XMaterial.COOKED_COD)
.setMin(0) .setMin(0)
.setMax(1).build())); .setMax(1).build()));
// Add Cod. // Add Cod.
lootManager.addLootable(new Lootable("COD", lootManager.addLootable(new Lootable("COD",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setBurnedMaterial(CompatibleMaterial.COOKED_COD).build(), .setBurnedMaterial(XMaterial.COOKED_COD).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE_MEAL) .setMaterial(XMaterial.BONE_MEAL)
.setChance(5).build())); .setChance(5).build()));
// Add Turtle. // Add Turtle.
lootManager.addLootable(new Lootable("TURTLE", lootManager.addLootable(new Lootable("TURTLE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SEAGRASS) .setMaterial(XMaterial.SEAGRASS)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Drowned. // Add Drowned.
lootManager.addLootable(new Lootable("DROWNED", lootManager.addLootable(new Lootable("DROWNED",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GOLD_INGOT) .setMaterial(XMaterial.GOLD_INGOT)
.setChance(5) .setChance(5)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
} }
@ -304,7 +305,7 @@ public class LootablesManager {
// Add Parrot. // Add Parrot.
lootManager.addLootable(new Lootable("PARROT", lootManager.addLootable(new Lootable("PARROT",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.FEATHER) .setMaterial(XMaterial.FEATHER)
.setMin(1) .setMin(1)
.setMax(2).build())); .setMax(2).build()));
} }
@ -312,30 +313,30 @@ public class LootablesManager {
Loot fish1 = new LootBuilder() Loot fish1 = new LootBuilder()
.addChildLoot(new LootBuilder() .addChildLoot(new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setBurnedMaterial(CompatibleMaterial.COOKED_COD) .setBurnedMaterial(XMaterial.COOKED_COD)
.setChance(50).build(), .setChance(50).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PRISMARINE_CRYSTALS) .setMaterial(XMaterial.PRISMARINE_CRYSTALS)
.setChance(33).build()) .setChance(33).build())
.build(); .build();
Loot fish2 = new LootBuilder() Loot fish2 = new LootBuilder()
.setChance(2.5) .setChance(2.5)
.addChildLoot(new LootBuilder() .addChildLoot(new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setChance(60) .setChance(60)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON) .setMaterial(XMaterial.SALMON)
.setChance(25) .setChance(25)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PUFFERFISH) .setMaterial(XMaterial.PUFFERFISH)
.setChance(13) .setChance(13)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.TROPICAL_FISH) .setMaterial(XMaterial.TROPICAL_FISH)
.setChance(2) .setChance(2)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.addOnlyDropFors(EntityType.PLAYER).build(); .addOnlyDropFors(EntityType.PLAYER).build();
@ -344,43 +345,43 @@ public class LootablesManager {
// Add Zombie Villager. // Add Zombie Villager.
lootManager.addLootable(new Lootable("ZOMBIE_VILLAGER", lootManager.addLootable(new Lootable("ZOMBIE_VILLAGER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setChance(2.5) .setChance(2.5)
.setChildDropCount(1) .setChildDropCount(1)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(XMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.CARROT) new LootBuilder().setMaterial(XMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.POTATO) new LootBuilder().setMaterial(XMaterial.POTATO)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.build())); .build()));
// Add Llama. // Add Llama.
lootManager.addLootable(new Lootable("LLAMA", lootManager.addLootable(new Lootable("LLAMA",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Zombie Horse. // Add Zombie Horse.
lootManager.addLootable(new Lootable("ZOMBIE_HORSE", lootManager.addLootable(new Lootable("ZOMBIE_HORSE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Elder Guardian. // Add Elder Guardian.
lootManager.addLootable(new Lootable("ELDER_GUARDIAN", lootManager.addLootable(new Lootable("ELDER_GUARDIAN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PRISMARINE_SHARD) .setMaterial(XMaterial.PRISMARINE_SHARD)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
fish1, fish1,
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SPONGE) .setMaterial(XMaterial.SPONGE)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
fish2)); fish2));
@ -388,23 +389,23 @@ public class LootablesManager {
// Add Mule. // Add Mule.
lootManager.addLootable(new Lootable("MULE", lootManager.addLootable(new Lootable("MULE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Stray. // Add Stray.
lootManager.addLootable(new Lootable("STRAY", lootManager.addLootable(new Lootable("STRAY",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ARROW) .setMaterial(XMaterial.ARROW)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE) .setMaterial(XMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
Loot witherSkull = new LootBuilder() Loot witherSkull = new LootBuilder()
.setMaterial(CompatibleMaterial.WITHER_SKELETON_SKULL) .setMaterial(XMaterial.WITHER_SKELETON_SKULL)
.setChance(2.5) .setChance(2.5)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER).build(); .addOnlyDropFors(EntityType.PLAYER).build();
@ -412,30 +413,30 @@ public class LootablesManager {
// Add Wither Skeleton. // Add Wither Skeleton.
lootManager.addLootable(new Lootable("WITHER_SKELETON", lootManager.addLootable(new Lootable("WITHER_SKELETON",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.COAL) .setMaterial(XMaterial.COAL)
.setChance(33).build(), .setChance(33).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE) .setMaterial(XMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
witherSkull)); // Add Skeleton Horse. witherSkull)); // Add Skeleton Horse.
lootManager.addLootable(new Lootable("SKELETON_HORSE", lootManager.addLootable(new Lootable("SKELETON_HORSE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE) .setMaterial(XMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Donkey. // Add Donkey.
lootManager.addLootable(new Lootable("DONKEY", lootManager.addLootable(new Lootable("DONKEY",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Vindicator. // Add Vindicator.
lootManager.addLootable(new Lootable("VINDICATOR", lootManager.addLootable(new Lootable("VINDICATOR",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.EMERALD) .setMaterial(XMaterial.EMERALD)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -443,10 +444,10 @@ public class LootablesManager {
// Add Evoker. // Add Evoker.
lootManager.addLootable(new Lootable("EVOKER", lootManager.addLootable(new Lootable("EVOKER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.TOTEM_OF_UNDYING) .setMaterial(XMaterial.TOTEM_OF_UNDYING)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.EMERALD) .setMaterial(XMaterial.EMERALD)
.setChance(50) .setChance(50)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
} }
@ -457,7 +458,7 @@ public class LootablesManager {
// Shulker. // Shulker.
lootManager.addLootable(new Lootable("SHULKER", lootManager.addLootable(new Lootable("SHULKER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SHULKER_SHELL) .setMaterial(XMaterial.SHULKER_SHELL)
.setChance(50) .setChance(50)
.setLootingIncrease(6.25).build())); .setLootingIncrease(6.25).build()));
} }
@ -466,12 +467,12 @@ public class LootablesManager {
// Add Polar Bear. // Add Polar Bear.
lootManager.addLootable(new Lootable("POLAR_BEAR", lootManager.addLootable(new Lootable("POLAR_BEAR",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setChance(75) .setChance(75)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON) .setMaterial(XMaterial.SALMON)
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
@ -479,12 +480,12 @@ public class LootablesManager {
// Add Polar Bear. // Add Polar Bear.
lootManager.addLootable(new Lootable("POLAR_BEAR", lootManager.addLootable(new Lootable("POLAR_BEAR",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.COD) .setMaterial(XMaterial.COD)
.setChance(75) .setChance(75)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON) .setMaterial(XMaterial.SALMON)
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
@ -493,8 +494,8 @@ public class LootablesManager {
// Add Pig. // Add Pig.
lootManager.addLootable(new Lootable("PIG", lootManager.addLootable(new Lootable("PIG",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PORKCHOP) .setMaterial(XMaterial.PORKCHOP)
.setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP) .setBurnedMaterial(XMaterial.COOKED_PORKCHOP)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
@ -502,62 +503,62 @@ public class LootablesManager {
// Add Cow. // Add Cow.
lootManager.addLootable(new Lootable("COW", lootManager.addLootable(new Lootable("COW",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BEEF) .setMaterial(XMaterial.BEEF)
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF) .setBurnedMaterial(XMaterial.COOKED_BEEF)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
// Add Mushroom Cow. // Add Mushroom Cow.
lootManager.addLootable(new Lootable("MUSHROOM_COW", lootManager.addLootable(new Lootable("MUSHROOM_COW",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BEEF) .setMaterial(XMaterial.BEEF)
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF) .setBurnedMaterial(XMaterial.COOKED_BEEF)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
// Add Chicken. // Add Chicken.
lootManager.addLootable(new Lootable("CHICKEN", lootManager.addLootable(new Lootable("CHICKEN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.FEATHER) .setMaterial(XMaterial.FEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.CHICKEN) .setMaterial(XMaterial.CHICKEN)
.setBurnedMaterial(CompatibleMaterial.COOKED_CHICKEN).build())); .setBurnedMaterial(XMaterial.COOKED_CHICKEN).build()));
// Add Zombie. // Add Zombie.
lootManager.addLootable(new Lootable("ZOMBIE", lootManager.addLootable(new Lootable("ZOMBIE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ZOMBIE_HEAD) .setMaterial(XMaterial.ZOMBIE_HEAD)
.setRequireCharged(true).build(), .setRequireCharged(true).build(),
new LootBuilder() new LootBuilder()
.setChance(2.5) .setChance(2.5)
.setChildDropCount(1) .setChildDropCount(1)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(XMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.CARROT) new LootBuilder().setMaterial(XMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.POTATO) new LootBuilder().setMaterial(XMaterial.POTATO)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.build())); .build()));
// Add Husk. // Add Husk.
lootManager.addLootable(new Lootable("ZOMBIE", lootManager.addLootable(new Lootable("ZOMBIE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
@ -565,45 +566,45 @@ public class LootablesManager {
.setChildDropCount(1) .setChildDropCount(1)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(XMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.CARROT) new LootBuilder().setMaterial(XMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(CompatibleMaterial.POTATO) new LootBuilder().setMaterial(XMaterial.POTATO)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.build())); .build()));
// Add Creeper. // Add Creeper.
lootManager.addLootable(new Lootable("CREEPER", lootManager.addLootable(new Lootable("CREEPER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GUNPOWDER) .setMaterial(XMaterial.GUNPOWDER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.CREEPER_HEAD) .setMaterial(XMaterial.CREEPER_HEAD)
.setRequireCharged(true).build(), .setRequireCharged(true).build(),
new LootBuilder() new LootBuilder()
.setChildDropCount(1) .setChildDropCount(1)
.addOnlyDropFors(EntityType.SKELETON, .addOnlyDropFors(EntityType.SKELETON,
ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11) ? EntityType.STRAY : null) ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11) ? EntityType.STRAY : null)
.addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_11).build(), .addChildLoot(new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_11).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_13).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_13).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_BLOCKS).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_BLOCKS).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_CAT).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_CAT).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_CHIRP).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_CHIRP).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_FAR).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_FAR).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_MALL).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_MALL).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_MELLOHI).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_MELLOHI).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_STAL).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_STAL).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_STRAD).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_STRAD).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_WAIT).build(), new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_WAIT).build(),
new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_WARD).build()) new LootBuilder().setMaterial(XMaterial.MUSIC_DISC_WARD).build())
.build())); .build()));
// Add Guardian. // Add Guardian.
lootManager.addLootable(new Lootable("GUARDIAN", lootManager.addLootable(new Lootable("GUARDIAN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PRISMARINE_SHARD) .setMaterial(XMaterial.PRISMARINE_SHARD)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
fish1, fish1,
@ -615,37 +616,37 @@ public class LootablesManager {
.setChildDropCounMin(1) .setChildDropCounMin(1)
.setChildDropCountMax(3) .setChildDropCountMax(3)
.addChildLoot(new LootBuilder() .addChildLoot(new LootBuilder()
.setMaterial(CompatibleMaterial.GLOWSTONE_DUST) .setMaterial(XMaterial.GLOWSTONE_DUST)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SUGAR) .setMaterial(XMaterial.SUGAR)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.REDSTONE) .setMaterial(XMaterial.REDSTONE)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SPIDER_EYE) .setMaterial(XMaterial.SPIDER_EYE)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GLASS_BOTTLE) .setMaterial(XMaterial.GLASS_BOTTLE)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GUNPOWDER) .setMaterial(XMaterial.GUNPOWDER)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.STICK) .setMaterial(XMaterial.STICK)
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build() .setMax(2).build()
@ -654,55 +655,55 @@ public class LootablesManager {
// Add Sheep. // Add Sheep.
lootManager.addLootable(new Lootable("SHEEP", lootManager.addLootable(new Lootable("SHEEP",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.MUTTON) .setMaterial(XMaterial.MUTTON)
.setBurnedMaterial(CompatibleMaterial.COOKED_MUTTON) .setBurnedMaterial(XMaterial.COOKED_MUTTON)
.setMin(1) .setMin(1)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.WHITE_WOOL) .setMaterial(XMaterial.WHITE_WOOL)
.setMin(2) .setMin(2)
.setMax(2).build())); .setMax(2).build()));
// Add Squid. // Add Squid.
lootManager.addLootable(new Lootable("SQUID", lootManager.addLootable(new Lootable("SQUID",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.INK_SAC) .setMaterial(XMaterial.INK_SAC)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
// Add Spider. // Add Spider.
lootManager.addLootable(new Lootable("SPIDER", lootManager.addLootable(new Lootable("SPIDER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.STRING) .setMaterial(XMaterial.STRING)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SPIDER_EYE) .setMaterial(XMaterial.SPIDER_EYE)
.setChance(33) .setChance(33)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
// Add Cave Spider. // Add Cave Spider.
lootManager.addLootable(new Lootable("CAVE_SPIDER", lootManager.addLootable(new Lootable("CAVE_SPIDER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.STRING) .setMaterial(XMaterial.STRING)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SPIDER_EYE) .setMaterial(XMaterial.SPIDER_EYE)
.setChance(33) .setChance(33)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
// Add Enderman. // Add Enderman.
lootManager.addLootable(new Lootable("ENDERMAN", lootManager.addLootable(new Lootable("ENDERMAN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ENDER_PEARL) .setMaterial(XMaterial.ENDER_PEARL)
.setMin(0) .setMin(0)
.setMax(1).build())); .setMax(1).build()));
// Add Blaze. // Add Blaze.
lootManager.addLootable(new Lootable("BLAZE", lootManager.addLootable(new Lootable("BLAZE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BLAZE_ROD) .setMaterial(XMaterial.BLAZE_ROD)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -710,79 +711,79 @@ public class LootablesManager {
// Add Horse. // Add Horse.
lootManager.addLootable(new Lootable("HORSE", lootManager.addLootable(new Lootable("HORSE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Magma Cube. // Magma Cube.
lootManager.addLootable(new Lootable("MAGMA_CUBE", lootManager.addLootable(new Lootable("MAGMA_CUBE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.MAGMA_CREAM) .setMaterial(XMaterial.MAGMA_CREAM)
.setChance(25).build())); .setChance(25).build()));
// Add Skeleton. // Add Skeleton.
lootManager.addLootable(new Lootable("SKELETON", lootManager.addLootable(new Lootable("SKELETON",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ARROW) .setMaterial(XMaterial.ARROW)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BONE) .setMaterial(XMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SKELETON_SKULL) .setMaterial(XMaterial.SKELETON_SKULL)
.setRequireCharged(true).build())); .setRequireCharged(true).build()));
// Add Snowman. // Add Snowman.
lootManager.addLootable(new Lootable("SNOWMAN", lootManager.addLootable(new Lootable("SNOWMAN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SNOWBALL) .setMaterial(XMaterial.SNOWBALL)
.setMin(0) .setMin(0)
.setMax(15).build())); .setMax(15).build()));
// Add Rabbit. // Add Rabbit.
lootManager.addLootable(new Lootable("RABBIT", lootManager.addLootable(new Lootable("RABBIT",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.RABBIT_HIDE) .setMaterial(XMaterial.RABBIT_HIDE)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.RABBIT_FOOT) .setMaterial(XMaterial.RABBIT_FOOT)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.setChance(10).build(), .setChance(10).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.RABBIT) .setMaterial(XMaterial.RABBIT)
.setBurnedMaterial(CompatibleMaterial.COOKED_RABBIT) .setBurnedMaterial(XMaterial.COOKED_RABBIT)
.setMin(0) .setMin(0)
.setMax(1).build())); .setMax(1).build()));
// Add Iron Golem. // Add Iron Golem.
lootManager.addLootable(new Lootable("IRON_GOLEM", lootManager.addLootable(new Lootable("IRON_GOLEM",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.POPPY) .setMaterial(XMaterial.POPPY)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.IRON_INGOT) .setMaterial(XMaterial.IRON_INGOT)
.setMin(3) .setMin(3)
.setMax(5).build())); .setMax(5).build()));
// Add Slime. // Add Slime.
lootManager.addLootable(new Lootable("SLIME", lootManager.addLootable(new Lootable("SLIME",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SLIME_BALL) .setMaterial(XMaterial.SLIME_BALL)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Ghast. // Add Ghast.
lootManager.addLootable(new Lootable("GHAST", lootManager.addLootable(new Lootable("GHAST",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GHAST_TEAR) .setMaterial(XMaterial.GHAST_TEAR)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GUNPOWDER) .setMaterial(XMaterial.GUNPOWDER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
@ -790,45 +791,45 @@ public class LootablesManager {
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_16)) if (ServerVersion.isServerVersionBelow(ServerVersion.V1_16))
lootManager.addLootable(new Lootable("PIG_ZOMBIE", lootManager.addLootable(new Lootable("PIG_ZOMBIE",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GOLD_NUGGET) .setMaterial(XMaterial.GOLD_NUGGET)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GOLD_INGOT) .setMaterial(XMaterial.GOLD_INGOT)
.setChance(2.5) .setChance(2.5)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
else { else {
// Add Strider // Add Strider
lootManager.addLootable(new Lootable("STRIDER", lootManager.addLootable(new Lootable("STRIDER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.STRING) .setMaterial(XMaterial.STRING)
.setMin(0) .setMin(0)
.setMax(5).build())); .setMax(5).build()));
// Add Hoglin // Add Hoglin
lootManager.addLootable(new Lootable("HOGLIN", lootManager.addLootable(new Lootable("HOGLIN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PORKCHOP) .setMaterial(XMaterial.PORKCHOP)
.setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP) .setBurnedMaterial(XMaterial.COOKED_PORKCHOP)
.setMin(2) .setMin(2)
.setMax(4).build(), .setMax(4).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.LEATHER) .setMaterial(XMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Zombified Piglin // Add Zombified Piglin
lootManager.addLootable(new Lootable("ZOMBIFIED_PIGLIN", lootManager.addLootable(new Lootable("ZOMBIFIED_PIGLIN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.ROTTEN_FLESH) .setMaterial(XMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GOLD_NUGGET) .setMaterial(XMaterial.GOLD_NUGGET)
.setMin(0) .setMin(0)
.setMax(1).build())); .setMax(1).build()));
@ -839,7 +840,7 @@ public class LootablesManager {
// Add Wither. // Add Wither.
lootManager.addLootable(new Lootable("WITHER", lootManager.addLootable(new Lootable("WITHER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.NETHER_STAR) .setMaterial(XMaterial.NETHER_STAR)
.setAllowLootingEnchant(false).build())); .setAllowLootingEnchant(false).build()));
// Add Villager. // Add Villager.

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.stackable.block; package com.craftaro.ultimatestacker.stackable.block;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.stack.block.BlockStack; import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
import com.craftaro.ultimatestacker.settings.Settings; import com.craftaro.ultimatestacker.settings.Settings;
@ -24,15 +25,15 @@ public class BlockStackImpl implements BlockStack {
private int id; private int id;
private int amount = 1; private int amount = 1;
private CompatibleMaterial material; private XMaterial material;
private Location location; private Location location;
public BlockStackImpl(CompatibleMaterial material, Location location) { public BlockStackImpl(XMaterial material, Location location) {
this.material = material; this.material = material;
this.location = location; this.location = location;
} }
public BlockStackImpl(CompatibleMaterial material, Location location, int amount) { public BlockStackImpl(XMaterial material, Location location, int amount) {
this.amount = amount; this.amount = amount;
this.material = material; this.material = material;
this.location = location; this.location = location;
@ -57,7 +58,7 @@ public class BlockStackImpl implements BlockStack {
public Data deserialize(Map<String, Object> map) { public Data deserialize(Map<String, Object> map) {
id = (int) map.get("id"); id = (int) map.get("id");
amount = (int) map.get("amount"); amount = (int) map.get("amount");
material = CompatibleMaterial.valueOf((String) map.get("material")); material = XMaterial.valueOf((String) map.get("material"));
location = SerializedLocation.of(map); location = SerializedLocation.of(map);
return this; return this;
} }
@ -87,7 +88,7 @@ public class BlockStackImpl implements BlockStack {
@Override @Override
public boolean isValid() { public boolean isValid() {
return CompatibleMaterial.getMaterial(location.getBlock()) == material; return XMaterial.matchXMaterial(location.getBlock().getType().name()).get() == material;
} }
@Override @Override
@ -115,7 +116,7 @@ public class BlockStackImpl implements BlockStack {
} }
@Override @Override
public CompatibleMaterial getMaterial() { public XMaterial getMaterial() {
return material; return material;
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.stackable.block; package com.craftaro.ultimatestacker.stackable.block;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.stack.block.BlockStack; import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager; import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
@ -41,18 +42,18 @@ public class BlockStackManagerImpl implements BlockStackManager {
} }
@Override @Override
public BlockStack getBlock(Block block, CompatibleMaterial material) { public BlockStack getBlock(Block block, XMaterial material) {
return this.getBlock(block.getLocation()); return this.getBlock(block.getLocation());
} }
@Override @Override
public BlockStack createBlock(Location location, CompatibleMaterial material) { public BlockStack createBlock(Location location, XMaterial material) {
return this.registeredBlocks.computeIfAbsent(location, b -> new BlockStackImpl(material, location)); return this.registeredBlocks.computeIfAbsent(location, b -> new BlockStackImpl(material, location));
} }
@Override @Override
public BlockStack createBlock(Block block) { public BlockStack createBlock(Block block) {
return this.createBlock(block.getLocation(), CompatibleMaterial.getMaterial(block)); return this.createBlock(block.getLocation(), XMaterial.matchXMaterial(block.getType().name()).get());
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.database.Data; import com.craftaro.core.database.Data;
import com.craftaro.core.database.SerializedLocation; import com.craftaro.core.database.SerializedLocation;
import com.craftaro.core.nms.world.SpawnedEntity; import com.craftaro.core.nms.world.SpawnedEntity;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.world.SSpawner; import com.craftaro.core.world.SSpawner;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI; import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
@ -17,6 +18,7 @@ import org.bukkit.entity.EntityType;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -44,7 +46,7 @@ public class SpawnerStackImpl implements SpawnerStack {
@Override @Override
public boolean isValid() { public boolean isValid() {
return CompatibleMaterial.getMaterial(this.location.getBlock()) == CompatibleMaterial.SPAWNER; return XMaterial.matchXMaterial(this.location.getBlock().getType().name()).filter(material -> material == XMaterial.SPAWNER).isPresent();
} }
@Override @Override
@ -76,11 +78,13 @@ public class SpawnerStackImpl implements SpawnerStack {
return count; return count;
} }
@Override
public int spawn(int amountToSpawn, EntityType... types) { public int spawn(int amountToSpawn, EntityType... types) {
return this.sSpawner.spawn(amountToSpawn, types); return this.sSpawner.spawn(amountToSpawn, types);
} }
public int spawn(int amountToSpawn, String particle, Set<CompatibleMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types) { @Override
public int spawn(int amountToSpawn, String particle, Set<XMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types) {
return this.sSpawner.spawn(amountToSpawn, particle, canSpawnOn, spawned, types); return this.sSpawner.spawn(amountToSpawn, particle, canSpawnOn, spawned, types);
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.tasks; package com.craftaro.ultimatestacker.tasks;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack; import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager; import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
@ -282,7 +283,7 @@ public class StackingTask extends TimerTask {
Bukkit.getScheduler().runTask(plugin, () -> { Bukkit.getScheduler().runTask(plugin, () -> {
if (baseEntity.isLeashed()) { if (baseEntity.isLeashed()) {
baseEntity.getWorld().dropItemNaturally(baseEntity.getLocation(), CompatibleMaterial.LEAD.getItem()); baseEntity.getWorld().dropItemNaturally(baseEntity.getLocation(), XMaterial.LEAD.parseItem());
} }
baseEntity.remove(); baseEntity.remove();
}); });

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.utils; package com.craftaro.ultimatestacker.utils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.UltimateStacker; import com.craftaro.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI; import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.stack.item.StackedItem; import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
@ -96,7 +97,7 @@ public class Methods {
} }
public static ItemStack getSpawnerItem(EntityType entityType, int amount) { public static ItemStack getSpawnerItem(EntityType entityType, int amount) {
ItemStack item = CompatibleMaterial.SPAWNER.getItem(); ItemStack item = XMaterial.SPAWNER.parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Methods.compileSpawnerName(entityType, amount)); meta.setDisplayName(Methods.compileSpawnerName(entityType, amount));
CreatureSpawner cs = (CreatureSpawner) ((BlockStateMeta) meta).getBlockState(); CreatureSpawner cs = (CreatureSpawner) ((BlockStateMeta) meta).getBlockState();

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.api.stack.block; package com.craftaro.ultimatestacker.api.stack.block;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.api.utils.Hologramable; import com.craftaro.ultimatestacker.api.utils.Hologramable;
import com.craftaro.ultimatestacker.api.utils.Stackable; import com.craftaro.ultimatestacker.api.utils.Stackable;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
@ -12,5 +13,5 @@ public interface BlockStack extends Stackable, Hologramable, Data {
void destroy(); void destroy();
CompatibleMaterial getMaterial(); XMaterial getMaterial();
} }

View File

@ -2,6 +2,7 @@ package com.craftaro.ultimatestacker.api.stack.block;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.database.Data; import com.craftaro.core.database.Data;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -20,9 +21,9 @@ public interface BlockStackManager {
BlockStack getBlock(Location location); BlockStack getBlock(Location location);
BlockStack getBlock(Block block, CompatibleMaterial material); BlockStack getBlock(Block block, XMaterial material);
BlockStack createBlock(Location location, CompatibleMaterial material); BlockStack createBlock(Location location, XMaterial material);
BlockStack createBlock(Block block); BlockStack createBlock(Block block);

View File

@ -1,5 +1,6 @@
package com.craftaro.ultimatestacker.api.stack.spawner; package com.craftaro.ultimatestacker.api.stack.spawner;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatestacker.api.utils.Hologramable; import com.craftaro.ultimatestacker.api.utils.Hologramable;
import com.craftaro.ultimatestacker.api.utils.Stackable; import com.craftaro.ultimatestacker.api.utils.Stackable;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
@ -43,5 +44,5 @@ public interface SpawnerStack extends Stackable, Hologramable, Data {
int spawn(int amountToSpawn, EntityType... types); int spawn(int amountToSpawn, EntityType... types);
int spawn(int amountToSpawn, String particle, Set<CompatibleMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types); int spawn(int amountToSpawn, String particle, Set<XMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types);
} }