Added Lootables GUI update.

This commit is contained in:
Brianna 2020-06-03 08:44:12 -05:00
parent 26549b17f4
commit 903fdd8e10
8 changed files with 214 additions and 224 deletions

View File

@ -116,7 +116,7 @@
<dependency> <dependency>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>Lootables</artifactId> <artifactId>Lootables</artifactId>
<version>LATEST</version> <version>1.0.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>

View File

@ -114,6 +114,7 @@ public class UltimateStacker extends SongodaPlugin {
.addSubCommand(new CommandReload()) .addSubCommand(new CommandReload())
.addSubCommand(new CommandGiveSpawner()) .addSubCommand(new CommandGiveSpawner())
.addSubCommand(new CommandSpawn()) .addSubCommand(new CommandSpawn())
.addSubCommand(new CommandLootables())
.addSubCommand(new CommandConvert(guiManager)); .addSubCommand(new CommandConvert(guiManager));
this.entityUtils = new EntityUtils(); this.entityUtils = new EntityUtils();
@ -320,6 +321,10 @@ public class UltimateStacker extends SongodaPlugin {
return dataManager; return dataManager;
} }
public GuiManager getGuiManager() {
return guiManager;
}
void loadHolograms() { void loadHolograms() {
Collection<SpawnerStack> spawners = getSpawnerStackManager().getStacks(); Collection<SpawnerStack> spawners = getSpawnerStackManager().getStacks();
if (spawners.isEmpty()) return; if (spawners.isEmpty()) return;

View File

@ -0,0 +1,54 @@
package com.songoda.ultimatestacker.commands;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.lootables.gui.GuiEditor;
import com.songoda.lootables.gui.GuiLootableEditor;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.entity.EntityStack;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class CommandLootables extends AbstractCommand {
UltimateStacker instance;
public CommandLootables() {
super(true, "lootables");
instance = UltimateStacker.getInstance();
}
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
Player p = (Player) sender;
instance.getGuiManager().showGUI(p, new GuiEditor(instance.getLootablesManager().getLootManager()));
return ReturnType.SUCCESS;
}
@Override
protected List<String> onTab(CommandSender sender, String... args) {
return null;
}
@Override
public String getPermissionNode() {
return "ultimatestacker.admin";
}
@Override
public String getSyntax() {
return "/us lootables";
}
@Override
public String getDescription() {
return "Modify the drop tables.";
}
}

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import java.util.List; import java.util.List;
public class CommandReload extends AbstractCommand { public class CommandReload extends AbstractCommand {
UltimateStacker instance; UltimateStacker instance;

View File

@ -4,9 +4,9 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion; import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.EntityUtils; import com.songoda.core.utils.EntityUtils;
import com.songoda.lootables.loot.Drop; import com.songoda.lootables.loot.Drop;
import com.songoda.lootables.loot.DropUtils;
import com.songoda.ultimatestacker.UltimateStacker; import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.settings.Settings; import com.songoda.ultimatestacker.settings.Settings;
import com.songoda.ultimatestacker.utils.DropUtils;
import com.songoda.ultimatestacker.utils.Methods; import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -181,7 +181,7 @@ public class EntityStack {
Map<String, MetadataValue> v = new HashMap<>(); Map<String, MetadataValue> v = new HashMap<>();
if (subject.getTicksLived() >= metaCarryOverMin) return v; if (subject.getTicksLived() >= metaCarryOverMin) return v;
Map<String, Map<Plugin, MetadataValue>> metadataMap = null; Map<String, Map<Plugin, MetadataValue>> metadataMap = null;
try { try {
Object entityMetadata = methodGetEntityMetadata.invoke(Bukkit.getServer()); Object entityMetadata = methodGetEntityMetadata.invoke(Bukkit.getServer());
metadataMap = (Map) fieldMetadataMap.get(entityMetadata); metadataMap = (Map) fieldMetadataMap.get(entityMetadata);

View File

@ -3,10 +3,10 @@ package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.ServerProject; import com.songoda.core.compatibility.ServerProject;
import com.songoda.core.compatibility.ServerVersion; import com.songoda.core.compatibility.ServerVersion;
import com.songoda.lootables.loot.Drop; import com.songoda.lootables.loot.Drop;
import com.songoda.lootables.loot.DropUtils;
import com.songoda.ultimatestacker.UltimateStacker; import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.entity.EntityStack; import com.songoda.ultimatestacker.entity.EntityStack;
import com.songoda.ultimatestacker.settings.Settings; import com.songoda.ultimatestacker.settings.Settings;
import com.songoda.ultimatestacker.utils.DropUtils;
import org.bukkit.GameRule; import org.bukkit.GameRule;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -113,7 +113,8 @@ public class DeathListeners implements Listener {
@EventHandler @EventHandler
public void onEntityHit(EntityDamageByEntityEvent event) { public void onEntityHit(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player) || ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) return; if (!(event.getDamager() instanceof Player) || ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12))
return;
if (!instance.getEntityStackManager().isStacked(event.getEntity())) return; if (!instance.getEntityStackManager().isStacked(event.getEntity())) return;
EntityStack stack = instance.getEntityStackManager().getStack(event.getEntity()); EntityStack stack = instance.getEntityStackManager().getStack(event.getEntity());

View File

@ -7,7 +7,6 @@ import com.songoda.lootables.Modify;
import com.songoda.lootables.loot.*; import com.songoda.lootables.loot.*;
import com.songoda.ultimatestacker.UltimateStacker; import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.settings.Settings; import com.songoda.ultimatestacker.settings.Settings;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -53,13 +52,11 @@ public class LootablesManager {
Modify modify = null; Modify modify = null;
if (entity.getType() == EntityType.SHEEP) { if (entity.getType() == EntityType.SHEEP) {
modify = (Loot loot2) -> { modify = (Loot loot2) -> {
Material material = loot2.getMaterial(); CompatibleMaterial material = loot2.getMaterial();
if (material.name().contains("WOOL") && ((Sheep) entity).getColor() != null) { if (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(Material.valueOf(((Sheep) entity).getColor() + "_WOOL")); loot2.setMaterial(CompatibleMaterial.valueOf(((Sheep) entity).getColor() + "_WOOL"));
else
loot2.setData((short) ((Sheep) entity).getColor().getWoolData());
} }
return loot2; return loot2;
@ -91,42 +88,41 @@ 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(Material.LEATHER) .setMaterial(CompatibleMaterial.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(Material.ARROW) .setMaterial(CompatibleMaterial.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(Material.SADDLE).build())); .setMaterial(CompatibleMaterial.SADDLE).build()));
// Add Cat. // Add Cat.
lootManager.addLootable(new Lootable("CAT", lootManager.addLootable(new Lootable("CAT",
new LootBuilder() new LootBuilder()
.setMaterial(Material.STRING).build())); .setMaterial(CompatibleMaterial.STRING).build()));
// Add Panda. // Add Panda.
lootManager.addLootable(new Lootable("PANDA", lootManager.addLootable(new Lootable("PANDA",
new LootBuilder() new LootBuilder()
.setMaterial(Material.BAMBOO) .setMaterial(CompatibleMaterial.BAMBOO)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
// Add Phantom. // Add Phantom.
lootManager.addLootable(new Lootable("PHANTOM", lootManager.addLootable(new Lootable("PHANTOM",
new LootBuilder() new LootBuilder()
.setMaterial(Material.PHANTOM_MEMBRANE) .setMaterial(CompatibleMaterial.PHANTOM_MEMBRANE)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -134,29 +130,29 @@ public class LootablesManager {
// Add Pufferfish. // Add Pufferfish.
lootManager.addLootable(new Lootable("PUFFERFISH", lootManager.addLootable(new Lootable("PUFFERFISH",
new LootBuilder() new LootBuilder()
.setMaterial(Material.PUFFERFISH).build(), .setMaterial(CompatibleMaterial.PUFFERFISH).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE_MEAL) .setMaterial(CompatibleMaterial.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(Material.SALMON) .setMaterial(CompatibleMaterial.SALMON)
.setBurnedMaterial(Material.COOKED_SALMON).build(), .setBurnedMaterial(CompatibleMaterial.COOKED_SALMON).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE_MEAL) .setMaterial(CompatibleMaterial.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(Material.TROPICAL_FISH).build(), .setMaterial(CompatibleMaterial.TROPICAL_FISH).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE_MEAL) .setMaterial(CompatibleMaterial.BONE_MEAL)
.setChance(5).build(), .setChance(5).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE) .setMaterial(CompatibleMaterial.BONE)
.setMin(1) .setMin(1)
.setMax(2) .setMax(2)
.setChance(25) .setChance(25)
@ -165,35 +161,35 @@ public class LootablesManager {
// Add Dolphin. // Add Dolphin.
lootManager.addLootable(new Lootable("DOLPHIN", lootManager.addLootable(new Lootable("DOLPHIN",
new LootBuilder() new LootBuilder()
.setMaterial(Material.COD) .setMaterial(CompatibleMaterial.COD)
.setBurnedMaterial(Material.COOKED_COD) .setBurnedMaterial(CompatibleMaterial.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(Material.COD) .setMaterial(CompatibleMaterial.COD)
.setBurnedMaterial(Material.COOKED_COD).build(), .setBurnedMaterial(CompatibleMaterial.COOKED_COD).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE_MEAL) .setMaterial(CompatibleMaterial.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(Material.SEAGRASS) .setMaterial(CompatibleMaterial.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(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.GOLD_INGOT) .setMaterial(CompatibleMaterial.GOLD_INGOT)
.setChance(5) .setChance(5)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
} }
@ -202,7 +198,7 @@ public class LootablesManager {
// Add Parrot. // Add Parrot.
lootManager.addLootable(new Lootable("PARROT", lootManager.addLootable(new Lootable("PARROT",
new LootBuilder() new LootBuilder()
.setMaterial(Material.FEATHER) .setMaterial(CompatibleMaterial.FEATHER)
.setMin(1) .setMin(1)
.setMax(2).build())); .setMax(2).build()));
} }
@ -210,34 +206,30 @@ public class LootablesManager {
Loot fish1 = new LootBuilder() Loot fish1 = new LootBuilder()
.addChildLoot(new LootBuilder() .addChildLoot(new LootBuilder()
.setMaterial(CompatibleMaterial.COD.getMaterial()) .setMaterial(CompatibleMaterial.COD)
.setBurnedMaterial(CompatibleMaterial.COOKED_COD.getMaterial()) .setBurnedMaterial(CompatibleMaterial.COOKED_COD)
.setChance(50).build(), .setChance(50).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.PRISMARINE_CRYSTALS) .setMaterial(CompatibleMaterial.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.getMaterial()) .setMaterial(CompatibleMaterial.COD)
.setData(CompatibleMaterial.COD.getData())
.setChance(60) .setChance(60)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON.getMaterial()) .setMaterial(CompatibleMaterial.SALMON)
.setData(CompatibleMaterial.SALMON.getData())
.setChance(25) .setChance(25)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.PUFFERFISH.getMaterial()) .setMaterial(CompatibleMaterial.PUFFERFISH)
.setData(CompatibleMaterial.PUFFERFISH.getData())
.setChance(13) .setChance(13)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.TROPICAL_FISH.getMaterial()) .setMaterial(CompatibleMaterial.TROPICAL_FISH)
.setData(CompatibleMaterial.TROPICAL_FISH.getData())
.setChance(2) .setChance(2)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.addOnlyDropFors(EntityType.PLAYER).build(); .addOnlyDropFors(EntityType.PLAYER).build();
@ -246,43 +238,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(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.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(Material.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.CARROT) new LootBuilder().setMaterial(CompatibleMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.POTATO) new LootBuilder().setMaterial(CompatibleMaterial.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(Material.LEATHER) .setMaterial(CompatibleMaterial.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(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.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(Material.PRISMARINE_SHARD) .setMaterial(CompatibleMaterial.PRISMARINE_SHARD)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
fish1, fish1,
new LootBuilder() new LootBuilder()
.setMaterial(Material.SPONGE) .setMaterial(CompatibleMaterial.SPONGE)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
fish2)); fish2));
@ -290,24 +282,23 @@ public class LootablesManager {
// Add Mule. // Add Mule.
lootManager.addLootable(new Lootable("MULE", lootManager.addLootable(new Lootable("MULE",
new LootBuilder() new LootBuilder()
.setMaterial(Material.LEATHER) .setMaterial(CompatibleMaterial.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(Material.ARROW) .setMaterial(CompatibleMaterial.ARROW)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE) .setMaterial(CompatibleMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
Loot witherSkull = new LootBuilder() Loot witherSkull = new LootBuilder()
.setMaterial(CompatibleMaterial.WITHER_SKELETON_SKULL.getMaterial()) .setMaterial(CompatibleMaterial.WITHER_SKELETON_SKULL)
.setData(CompatibleMaterial.WITHER_SKELETON_SKULL.getData())
.setChance(2.5) .setChance(2.5)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER).build(); .addOnlyDropFors(EntityType.PLAYER).build();
@ -315,30 +306,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(Material.COAL) .setMaterial(CompatibleMaterial.COAL)
.setChance(33).build(), .setChance(33).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE) .setMaterial(CompatibleMaterial.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(Material.BONE) .setMaterial(CompatibleMaterial.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(Material.LEATHER) .setMaterial(CompatibleMaterial.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(Material.EMERALD) .setMaterial(CompatibleMaterial.EMERALD)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -346,10 +337,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.getMaterial()) .setMaterial(CompatibleMaterial.TOTEM_OF_UNDYING)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.EMERALD) .setMaterial(CompatibleMaterial.EMERALD)
.setChance(50) .setChance(50)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
} }
@ -360,7 +351,7 @@ public class LootablesManager {
// Shulker. // Shulker.
lootManager.addLootable(new Lootable("SHULKER", lootManager.addLootable(new Lootable("SHULKER",
new LootBuilder() new LootBuilder()
.setMaterial(Material.SHULKER_SHELL) .setMaterial(CompatibleMaterial.SHULKER_SHELL)
.setChance(50) .setChance(50)
.setLootingIncrease(6.25).build())); .setLootingIncrease(6.25).build()));
} }
@ -369,12 +360,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(Material.COD) .setMaterial(CompatibleMaterial.COD)
.setChance(75) .setChance(75)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.SALMON) .setMaterial(CompatibleMaterial.SALMON)
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
@ -382,13 +373,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.getMaterial()) .setMaterial(CompatibleMaterial.COD)
.setChance(75) .setChance(75)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SALMON.getMaterial()) .setMaterial(CompatibleMaterial.SALMON)
.setData(CompatibleMaterial.SALMON.getData())
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
@ -397,8 +387,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.getMaterial()) .setMaterial(CompatibleMaterial.PORKCHOP)
.setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP.getMaterial()) .setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP)
.setMin(1) .setMin(1)
.setMax(3).build())); .setMax(3).build()));
@ -406,40 +396,40 @@ public class LootablesManager {
// Add Cow. // Add Cow.
lootManager.addLootable(new Lootable("COW", lootManager.addLootable(new Lootable("COW",
new LootBuilder() new LootBuilder()
.setMaterial(Material.LEATHER) .setMaterial(CompatibleMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BEEF.getMaterial()) .setMaterial(CompatibleMaterial.BEEF)
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF.getMaterial()) .setBurnedMaterial(CompatibleMaterial.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(Material.LEATHER) .setMaterial(CompatibleMaterial.LEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.BEEF.getMaterial()) .setMaterial(CompatibleMaterial.BEEF)
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF.getMaterial()) .setBurnedMaterial(CompatibleMaterial.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(Material.FEATHER) .setMaterial(CompatibleMaterial.FEATHER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.CHICKEN.getMaterial()) .setMaterial(CompatibleMaterial.CHICKEN)
.setBurnedMaterial(CompatibleMaterial.COOKED_CHICKEN.getMaterial()).build())); .setBurnedMaterial(CompatibleMaterial.COOKED_CHICKEN).build()));
// Add Zombie. // Add Zombie.
lootManager.addLootable(new Lootable("ZOMBIE", lootManager.addLootable(new Lootable("ZOMBIE",
new LootBuilder() new LootBuilder()
.setMaterial(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
@ -447,18 +437,18 @@ public class LootablesManager {
.setChildDropCount(1) .setChildDropCount(1)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.addChildLoot(new LootBuilder().setMaterial(Material.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.CARROT) new LootBuilder().setMaterial(CompatibleMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.POTATO) new LootBuilder().setMaterial(CompatibleMaterial.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(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
@ -466,11 +456,11 @@ public class LootablesManager {
.setChildDropCount(1) .setChildDropCount(1)
.setAllowLootingEnchant(false) .setAllowLootingEnchant(false)
.addOnlyDropFors(EntityType.PLAYER) .addOnlyDropFors(EntityType.PLAYER)
.addChildLoot(new LootBuilder().setMaterial(Material.IRON_INGOT) .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.IRON_INGOT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.CARROT) new LootBuilder().setMaterial(CompatibleMaterial.CARROT)
.setAllowLootingEnchant(false).build(), .setAllowLootingEnchant(false).build(),
new LootBuilder().setMaterial(Material.POTATO) new LootBuilder().setMaterial(CompatibleMaterial.POTATO)
.setAllowLootingEnchant(false).build()) .setAllowLootingEnchant(false).build())
.build())); .build()));
@ -480,60 +470,60 @@ public class LootablesManager {
.setChildDropCount(1) .setChildDropCount(1)
.addOnlyDropFors(EntityType.SKELETON, .addOnlyDropFors(EntityType.SKELETON,
EntityType.STRAY) EntityType.STRAY)
.addChildLoot(new LootBuilder().setMaterial(Material.MUSIC_DISC_11).build(), .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_11).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_13).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_13).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_BLOCKS).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_BLOCKS).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_CAT).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_CAT).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_CHIRP).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_CHIRP).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_FAR).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_FAR).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_MALL).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_MALL).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_MELLOHI).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_MELLOHI).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_STAL).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_STAL).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_STRAD).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_STRAD).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_WAIT).build(), new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_WAIT).build(),
new LootBuilder().setMaterial(Material.MUSIC_DISC_WARD).build()) new LootBuilder().setMaterial(CompatibleMaterial.MUSIC_DISC_WARD).build())
.build(); .build();
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { } else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
discs = new LootBuilder() discs = new LootBuilder()
.setChildDropCount(1) .setChildDropCount(1)
.addOnlyDropFors(EntityType.SKELETON, .addOnlyDropFors(EntityType.SKELETON,
EntityType.STRAY) EntityType.STRAY)
.addChildLoot(new LootBuilder().setMaterial(Material.valueOf("GOLD_RECORD")).build(), .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.valueOf("GOLD_RECORD")).build(),
new LootBuilder().setMaterial(Material.valueOf("GREEN_RECORD")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("GREEN_RECORD")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_3")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_3")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_4")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_4")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_5")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_5")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_6")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_6")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_7")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_7")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_8")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_8")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_9")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_9")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_10")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_10")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_11")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_11")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_12")).build()) new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_12")).build())
.build(); .build();
} else { } else {
discs = new LootBuilder() discs = new LootBuilder()
.setChildDropCount(1) .setChildDropCount(1)
.addOnlyDropFors(EntityType.SKELETON) .addOnlyDropFors(EntityType.SKELETON)
.addChildLoot(new LootBuilder().setMaterial(Material.valueOf("GOLD_RECORD")).build(), .addChildLoot(new LootBuilder().setMaterial(CompatibleMaterial.valueOf("GOLD_RECORD")).build(),
new LootBuilder().setMaterial(Material.valueOf("GREEN_RECORD")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("GREEN_RECORD")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_3")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_3")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_4")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_4")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_5")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_5")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_6")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_6")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_7")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_7")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_8")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_8")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_9")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_9")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_10")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_10")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_11")).build(), new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_11")).build(),
new LootBuilder().setMaterial(Material.valueOf("RECORD_12")).build()) new LootBuilder().setMaterial(CompatibleMaterial.valueOf("RECORD_12")).build())
.build(); .build();
} }
// Add Creeper. // Add Creeper.
lootManager.addLootable(new Lootable("CREEPER", lootManager.addLootable(new Lootable("CREEPER",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GUNPOWDER.getMaterial()) .setMaterial(CompatibleMaterial.GUNPOWDER)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
discs)); discs));
@ -541,7 +531,7 @@ public class LootablesManager {
// Add Guardian. // Add Guardian.
lootManager.addLootable(new Lootable("GUARDIAN", lootManager.addLootable(new Lootable("GUARDIAN",
new LootBuilder() new LootBuilder()
.setMaterial(Material.PRISMARINE_SHARD) .setMaterial(CompatibleMaterial.PRISMARINE_SHARD)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
fish1, fish1,
@ -553,37 +543,37 @@ public class LootablesManager {
.setChildDropCounMin(1) .setChildDropCounMin(1)
.setChildDropCountMax(3) .setChildDropCountMax(3)
.addChildLoot(new LootBuilder() .addChildLoot(new LootBuilder()
.setMaterial(Material.GLOWSTONE_DUST) .setMaterial(CompatibleMaterial.GLOWSTONE_DUST)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.SUGAR) .setMaterial(CompatibleMaterial.SUGAR)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.REDSTONE) .setMaterial(CompatibleMaterial.REDSTONE)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.SPIDER_EYE) .setMaterial(CompatibleMaterial.SPIDER_EYE)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.GLASS_BOTTLE) .setMaterial(CompatibleMaterial.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.getMaterial()) .setMaterial(CompatibleMaterial.GUNPOWDER)
.setChance(12.5) .setChance(12.5)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.STICK) .setMaterial(CompatibleMaterial.STICK)
.setChance(25) .setChance(25)
.setMin(0) .setMin(0)
.setMax(2).build() .setMax(2).build()
@ -592,55 +582,55 @@ public class LootablesManager {
// Add Sheep. // Add Sheep.
lootManager.addLootable(new Lootable("SHEEP", lootManager.addLootable(new Lootable("SHEEP",
new LootBuilder() new LootBuilder()
.setMaterial(Material.MUTTON) .setMaterial(CompatibleMaterial.MUTTON)
.setBurnedMaterial(Material.COOKED_MUTTON) .setBurnedMaterial(CompatibleMaterial.COOKED_MUTTON)
.setMin(1) .setMin(1)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.WHITE_WOOL.getMaterial()) .setMaterial(CompatibleMaterial.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.getMaterial()) .setMaterial(CompatibleMaterial.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(Material.STRING) .setMaterial(CompatibleMaterial.STRING)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.SPIDER_EYE) .setMaterial(CompatibleMaterial.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(Material.STRING) .setMaterial(CompatibleMaterial.STRING)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.SPIDER_EYE) .setMaterial(CompatibleMaterial.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(Material.ENDER_PEARL) .setMaterial(CompatibleMaterial.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(Material.BLAZE_ROD) .setMaterial(CompatibleMaterial.BLAZE_ROD)
.setMin(0) .setMin(0)
.setMax(1) .setMax(1)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
@ -648,93 +638,93 @@ public class LootablesManager {
// Add Horse. // Add Horse.
lootManager.addLootable(new Lootable("HORSE", lootManager.addLootable(new Lootable("HORSE",
new LootBuilder() new LootBuilder()
.setMaterial(Material.LEATHER) .setMaterial(CompatibleMaterial.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(Material.MAGMA_CREAM) .setMaterial(CompatibleMaterial.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(Material.ARROW) .setMaterial(CompatibleMaterial.ARROW)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.BONE) .setMaterial(CompatibleMaterial.BONE)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Snowman. // Add Snowman.
lootManager.addLootable(new Lootable("SNOWMAN", lootManager.addLootable(new Lootable("SNOWMAN",
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.SNOWBALL.getMaterial()) .setMaterial(CompatibleMaterial.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(Material.RABBIT_HIDE) .setMaterial(CompatibleMaterial.RABBIT_HIDE)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.RABBIT) .setMaterial(CompatibleMaterial.RABBIT)
.setBurnedMaterial(Material.COOKED_RABBIT) .setBurnedMaterial(CompatibleMaterial.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.getMaterial()) .setMaterial(CompatibleMaterial.POPPY)
.setMin(0) .setMin(0)
.setMax(2).build(), .setMax(2).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.IRON_INGOT) .setMaterial(CompatibleMaterial.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(Material.SLIME_BALL) .setMaterial(CompatibleMaterial.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(Material.GHAST_TEAR) .setMaterial(CompatibleMaterial.GHAST_TEAR)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(CompatibleMaterial.GUNPOWDER.getMaterial()) .setMaterial(CompatibleMaterial.GUNPOWDER)
.setMin(0) .setMin(0)
.setMax(2).build())); .setMax(2).build()));
// Add Zombie Pigman // Add Zombie Pigman
lootManager.addLootable(new Lootable("PIG_ZOMBIE", lootManager.addLootable(new Lootable("PIG_ZOMBIE",
new LootBuilder() new LootBuilder()
.setMaterial(Material.ROTTEN_FLESH) .setMaterial(CompatibleMaterial.ROTTEN_FLESH)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.GOLD_NUGGET) .setMaterial(CompatibleMaterial.GOLD_NUGGET)
.setMin(0) .setMin(0)
.setMax(1).build(), .setMax(1).build(),
new LootBuilder() new LootBuilder()
.setMaterial(Material.GOLD_INGOT) .setMaterial(CompatibleMaterial.GOLD_INGOT)
.setChance(2.5) .setChance(2.5)
.addOnlyDropFors(EntityType.PLAYER).build())); .addOnlyDropFors(EntityType.PLAYER).build()));
// Add Wither. // Add Wither.
lootManager.addLootable(new Lootable("WITHER", lootManager.addLootable(new Lootable("WITHER",
new LootBuilder() new LootBuilder()
.setMaterial(Material.NETHER_STAR) .setMaterial(CompatibleMaterial.NETHER_STAR)
.setAllowLootingEnchant(false).build())); .setAllowLootingEnchant(false).build()));
// Add Villager. // Add Villager.
@ -745,7 +735,7 @@ public class LootablesManager {
lootManager.addLootable(new Lootable("SILVERFISH", lootManager.addLootable(new Lootable("SILVERFISH",
new LootBuilder().build())); new LootBuilder().build()));
lootManager.saveLootables(); lootManager.saveLootables(true);
} }
public LootManager getLootManager() { public LootManager getLootManager() {

View File

@ -1,60 +0,0 @@
package com.songoda.ultimatestacker.utils;
import com.songoda.lootables.loot.Drop;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class DropUtils {
public static void processStackedDrop(LivingEntity entity, List<Drop> drops, EntityDeathEvent event) {
List<ItemStack> items = new ArrayList<>();
List<String> commands = new ArrayList<>();
for (Drop drop : drops) {
if (drop == null) continue;
ItemStack droppedItem = drop.getItemStack();
if (droppedItem != null) {
droppedItem = droppedItem.clone();
boolean success = false;
for (ItemStack item : items) {
if (item.getType() != droppedItem.getType()
|| item.getDurability() != droppedItem.getDurability()
|| item.getAmount() + droppedItem.getAmount() > droppedItem.getMaxStackSize()) continue;
item.setAmount(item.getAmount() + droppedItem.getAmount());
success = true;
break;
}
if (!success)
items.add(droppedItem);
}
if (drop.getCommand() != null)
commands.add(drop.getCommand());
}
event.getDrops().clear();
if (!items.isEmpty())
dropItems(items, event);
else if (!commands.isEmpty())
runCommands(entity, commands);
}
private static void dropItems(List<ItemStack> items, EntityDeathEvent event) {
for (ItemStack item : items)
event.getDrops().add(item);
}
private static void runCommands(LivingEntity entity, List<String> commands) {
for (String command : commands) {
if (entity.getKiller() != null)
command = command.replace("%player%", entity.getKiller().getName());
if (!command.contains("%player%"))
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
}
}
}