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

View File

@ -1,5 +1,6 @@
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.WildStackerConvert;
import com.craftaro.core.compatibility.CompatibleMaterial;
@ -15,12 +16,12 @@ public class GUIConvert extends Gui {
setRows(1);
int current = 0;
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)));
}
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)));
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
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.api.stack.block.BlockStack;
import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
@ -41,18 +42,18 @@ public class BlockStackManagerImpl implements BlockStackManager {
}
@Override
public BlockStack getBlock(Block block, CompatibleMaterial material) {
public BlockStack getBlock(Block block, XMaterial material) {
return this.getBlock(block.getLocation());
}
@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));
}
@Override
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

View File

@ -4,6 +4,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.database.Data;
import com.craftaro.core.database.SerializedLocation;
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.ultimatestacker.UltimateStacker;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
@ -17,6 +18,7 @@ import org.bukkit.entity.EntityType;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
@ -44,7 +46,7 @@ public class SpawnerStackImpl implements SpawnerStack {
@Override
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
@ -76,11 +78,13 @@ public class SpawnerStackImpl implements SpawnerStack {
return count;
}
@Override
public int spawn(int amountToSpawn, EntityType... 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);
}

View File

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

View File

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

View File

@ -1,5 +1,6 @@
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.Stackable;
import com.craftaro.core.compatibility.CompatibleMaterial;
@ -12,5 +13,5 @@ public interface BlockStack extends Stackable, Hologramable, Data {
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.database.Data;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -20,9 +21,9 @@ public interface BlockStackManager {
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);

View File

@ -1,5 +1,6 @@
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.Stackable;
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, String particle, Set<CompatibleMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types);
int spawn(int amountToSpawn, String particle, Set<XMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types);
}