From 51d12f53e7051c7862a64ca5edc6d54e21a0e387 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 27 Nov 2013 12:06:32 -0700 Subject: [PATCH] Added in DiabloDropsHook patch. --- .../me/kaZep/Commands/commandBankEconomy.java | 28 +++++++++++ .../src/sig/ItemSets/DiabloDropsHook.java | 46 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 BankEconomyMod/src/sig/ItemSets/DiabloDropsHook.java diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 17ea407..76af5e5 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -44,6 +44,8 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import sig.ItemSets.DiabloDropsHook; + import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; @@ -529,6 +531,32 @@ public String convertToItemName(String val) { } this.plugin.saveConfig(); } + if (args[0].equalsIgnoreCase("diablodrops")) { + //Generates a random diablodrops item. Just like if you did /diablodrops + p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getRandomItem()); + } + if (args[0].equalsIgnoreCase("diablodrops_mat")) { + //Generates diamond swords that have random diablodrops attributes. + p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getRandomItem(Material.DIAMOND_SWORD)); + } + if (args[0].equalsIgnoreCase("diablodrops_tier")) { + //Only drops legendary tier diablodrops items. (Orange lettering, high stats.) + p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getTierItem(Tier.Legendary)); + } + if (args[0].equalsIgnoreCase("diablodrops_mat+tier")) { + //Only drops diamond chestplates that are unidentified. + p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getTierItem(Material.DIAMOND_CHESTPLATE, Tier.Unidentified)); + } + if (args[0].equalsIgnoreCase("diablodrops_item")) { + //Only drops Iron Axes. Basically the same as the material version, but accepts an ItemStack (Which may have additional properties, or may be unidentified!) + p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getItem(new ItemStack(Material.IRON_AXE))); + } + if (args[0].equalsIgnoreCase("diablodrops_chestloot")) { + if (p.getTargetBlock(null, 5).getType()==Material.CHEST) { + //Fills a chest you look at with 20 random diablodrops items. + DiabloDropsHook.fillChest(p.getTargetBlock(null, 5), 20); + } + } if (args[0].equalsIgnoreCase("loot")) { p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); } } else diff --git a/BankEconomyMod/src/sig/ItemSets/DiabloDropsHook.java b/BankEconomyMod/src/sig/ItemSets/DiabloDropsHook.java new file mode 100644 index 0000000..0ee59f6 --- /dev/null +++ b/BankEconomyMod/src/sig/ItemSets/DiabloDropsHook.java @@ -0,0 +1,46 @@ +package sig.ItemSets; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.inventory.ItemStack; + +import com.modcrafting.diablodrops.DiabloDrops; + +public class DiabloDropsHook { + /** + * + * (Note that these are defined in /plugins/Diablodrops/tier.yml. They could be modified if you really wanted to! + * Legendary - (Gold Color) Up to 7 enchantments, up to level 10. + * Lore - (Yellow Color) Up to 7 enchantments, up to level 9. + * Magical - (Blue Color) Up to 3 enchantments, up to level 4. + * Rare - (Red Color) Up to 5 enchantments, up to level 5. + * Set - (Green Color) Up to 7 enchantments, up to level 6. + * Unidentified - (Magic Letters) Up to 10 enchantments, up to level 10. + * + */ + public enum Tier {Legendary, Lore, Magical, Rare, Set, Unidentified}; + + public static ItemStack getRandomItem() { + return DiabloDrops.getInstance().getDropAPI().getItem(); + } + public static ItemStack getRandomItem(Material mat) { + //Returns a random Diablodrops item that is of a certain material type.. + return DiabloDrops.getInstance().getDropAPI().getItem(mat); + } + public static ItemStack getTierItem(Tier tier) { + //Returns a random Diablodrops item that is of a certain tier type.. (Use the Tier enum types) + return DiabloDrops.getInstance().getDropAPI().getItem(DiabloDrops.getInstance().getDropAPI().getTier(tier.name())); + } + public static ItemStack getTierItem(Material mat, Tier tier) { + //Returns a random Diablodrops item that is of a certain material type and tier type.. (Use the Tier enum types) + return DiabloDrops.getInstance().getDropAPI().getItem(mat, DiabloDrops.getInstance().getDropAPI().getTier(tier.name())); + } + public static ItemStack getItem(ItemStack i) { + //Turns an item into a Diablodrops special item. + return DiabloDrops.getInstance().getDropAPI().getItem(i); + } + public static void fillChest(Block b, int size) { + //Fills a specified chest in the world with loot. + DiabloDrops.getInstance().getDropAPI().fillChest(b, size); + } +}