Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package AiInmates;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import CustomEnchantments.EnchantedBookManager;
- import Utils.Utils;
- public class InmateLootManager {
- public static void GivePlayerRandomLoot(Player p, String InmateName) {
- Inventory inv2 = Bukkit.getServer().createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', InmateName + "`s &4Loot"));
- for (int i = 0; i < 15; i++) {
- int key = Utils.randInt(0, 30);
- ItemStack iStack = new ItemStack(GetRandomLoot(key), Utils.randInt(1, GetRandomLootAmount(key)), GetRandomLootDataType(key));
- inv2.setItem(Utils.randInt(0, 25), iStack);
- }
- if (Utils.PercentChance(25)) {
- int Tier = Utils.randInt(1, 5);
- if (Utils.PercentChance(50)) {
- inv2.setItem(13, EnchantedBookManager.GetBook(Tier));
- } else {
- inv2.setItem(13, EnchantedBookManager.GetRandomEnchantmentBook(null, Tier));
- }
- }
- p.openInventory(inv2);
- }
- public static byte GetRandomLootDataType(int key) {
- switch (key) {
- case 32: return 2;
- case 33: return 5;
- default: return 0;
- }
- }
- public static int GetRandomLootAmount(int key) {
- switch (key) {
- case 1: return 64;
- case 2: return 32;
- case 3: return 1;
- case 4: return 3;
- case 5: return 10;
- case 6: return 2;
- case 7: return 13;
- case 8: return 16;
- case 9: return 1;
- case 10: return 3;
- case 11: return 8;
- case 12: return 8;
- case 13: return 8;
- case 14: return 2;
- case 15:return 16;
- case 16:return 8;
- case 17:
- return 8;
- case 18:
- return 16;
- case 19:
- return 5;
- case 20:
- return 2;
- case 21:
- return 8;
- case 22:
- return 2;
- case 23:
- return 32;
- case 24:
- return 3;
- case 25:
- return 8;
- case 26:
- return 2;
- case 27:
- return 10;
- case 28:
- return 4;
- case 29:
- return 3;
- case 30:
- return 1;
- case 31:
- return 10;
- case 32:
- return 64;
- case 33:
- return 50;
- }
- return 1;
- }
- public static Material GetRandomLoot(int key) {
- switch (key) {
- case 1:
- return Material.STONE;
- case 2:
- return Material.LOG;
- case 3:
- return Material.DIAMOND;
- case 4:
- return Material.GOLD_INGOT;
- case 5:
- return Material.COAL;
- case 6:
- return Material.IRON_INGOT;
- case 7:
- return Material.REDSTONE;
- case 8:
- return Material.EXP_BOTTLE;
- case 9:
- return Material.IRON_PLATE;
- case 10:
- return Material.WOOD_BUTTON;
- case 11:
- return Material.APPLE;
- case 12:
- return Material.BREAD;
- case 13:
- return Material.COOKED_BEEF;
- case 14:
- return Material.CACTUS;
- case 15:
- return Material.DIRT;
- case 16:
- return Material.GRAVEL;
- case 17:
- return Material.SAND;
- case 18:
- return Material.WOOD;
- case 19:
- return Material.STICK;
- case 20:
- return Material.WEB;
- case 21:
- return Material.WOOL;
- case 22:
- return Material.GLOWSTONE;
- case 23:
- return Material.CLAY_BALL;
- case 24:
- return Material.BLAZE_POWDER;
- case 25:
- return Material.LEAVES_2;
- case 26:
- return Material.BOWL;
- case 27:
- return Material.SLIME_BALL;
- case 28:
- return Material.QUARTZ;
- case 29:
- return Material.LEATHER;
- case 30:
- return Material.SHEARS;
- case 31:
- return Material.CHEST;
- case 32:
- return Material.WOOL;
- case 33:
- return Material.WOOL;
- }
- return Material.STONE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement