Advertisement
Guest User

Untitled

a guest
May 29th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.50 KB | None | 0 0
  1. package AiInmates;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Material;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.inventory.Inventory;
  8. import org.bukkit.inventory.ItemStack;
  9.  
  10. import CustomEnchantments.EnchantedBookManager;
  11. import Utils.Utils;
  12.  
  13. public class InmateLootManager {
  14.     public static void GivePlayerRandomLoot(Player p, String InmateName) {
  15.         Inventory inv2 = Bukkit.getServer().createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', InmateName + "`s &4Loot"));
  16.         for (int i = 0; i < 15; i++) {
  17.             int key = Utils.randInt(0, 30);
  18.             ItemStack iStack = new ItemStack(GetRandomLoot(key), Utils.randInt(1, GetRandomLootAmount(key)), GetRandomLootDataType(key));
  19.             inv2.setItem(Utils.randInt(0, 25), iStack);
  20.         }
  21.         if (Utils.PercentChance(25)) {
  22.             int Tier = Utils.randInt(1, 5);
  23.             if (Utils.PercentChance(50)) {
  24.                 inv2.setItem(13, EnchantedBookManager.GetBook(Tier));
  25.             } else {
  26.                 inv2.setItem(13, EnchantedBookManager.GetRandomEnchantmentBook(null, Tier));
  27.             }
  28.         }
  29.         p.openInventory(inv2);
  30.     }
  31.  
  32.     public static byte GetRandomLootDataType(int key) {
  33.         switch (key) {
  34.         case 32: return 2;
  35.         case 33: return 5;
  36.        
  37.         default: return 0;
  38.         }
  39.     }
  40.    
  41.     public static int GetRandomLootAmount(int key) {
  42.         switch (key) {
  43.         case 1: return 64;
  44.         case 2: return 32;
  45.         case 3: return 1;
  46.         case 4: return 3;
  47.         case 5: return 10;
  48.         case 6: return 2;
  49.         case 7: return 13;
  50.         case 8: return 16;
  51.         case 9: return 1;
  52.         case 10: return 3;
  53.         case 11: return 8;
  54.         case 12: return 8;
  55.         case 13: return 8;
  56.         case 14: return 2;
  57.         case 15:return 16;
  58.         case 16:return 8;
  59.         case 17:
  60.             return 8;
  61.         case 18:
  62.             return 16;
  63.         case 19:
  64.             return 5;
  65.         case 20:
  66.             return 2;
  67.         case 21:
  68.             return 8;
  69.         case 22:
  70.             return 2;
  71.         case 23:
  72.             return 32;
  73.         case 24:
  74.             return 3;
  75.         case 25:
  76.             return 8;
  77.         case 26:
  78.             return 2;
  79.         case 27:
  80.             return 10;
  81.         case 28:
  82.             return 4;
  83.         case 29:
  84.             return 3;
  85.         case 30:
  86.             return 1;
  87.         case 31:
  88.             return 10;
  89.         case 32:
  90.             return 64;
  91.         case 33:
  92.             return 50;
  93.         }
  94.         return 1;
  95.     }
  96.  
  97.     public static Material GetRandomLoot(int key) {
  98.         switch (key) {
  99.         case 1:
  100.             return Material.STONE;
  101.         case 2:
  102.             return Material.LOG;
  103.         case 3:
  104.             return Material.DIAMOND;
  105.         case 4:
  106.             return Material.GOLD_INGOT;
  107.         case 5:
  108.             return Material.COAL;
  109.         case 6:
  110.             return Material.IRON_INGOT;
  111.         case 7:
  112.             return Material.REDSTONE;
  113.         case 8:
  114.             return Material.EXP_BOTTLE;
  115.         case 9:
  116.             return Material.IRON_PLATE;
  117.         case 10:
  118.             return Material.WOOD_BUTTON;
  119.         case 11:
  120.             return Material.APPLE;
  121.         case 12:
  122.             return Material.BREAD;
  123.         case 13:
  124.             return Material.COOKED_BEEF;
  125.         case 14:
  126.             return Material.CACTUS;
  127.         case 15:
  128.             return Material.DIRT;
  129.         case 16:
  130.             return Material.GRAVEL;
  131.         case 17:
  132.             return Material.SAND;
  133.         case 18:
  134.             return Material.WOOD;
  135.         case 19:
  136.             return Material.STICK;
  137.         case 20:
  138.             return Material.WEB;
  139.         case 21:
  140.             return Material.WOOL;
  141.         case 22:
  142.             return Material.GLOWSTONE;
  143.         case 23:
  144.             return Material.CLAY_BALL;
  145.         case 24:
  146.             return Material.BLAZE_POWDER;
  147.         case 25:
  148.             return Material.LEAVES_2;
  149.         case 26:
  150.             return Material.BOWL;
  151.         case 27:
  152.             return Material.SLIME_BALL;
  153.         case 28:
  154.             return Material.QUARTZ;
  155.         case 29:
  156.             return Material.LEATHER;
  157.         case 30:
  158.             return Material.SHEARS;
  159.         case 31:
  160.             return Material.CHEST;
  161.         case 32:
  162.             return Material.WOOL;
  163.         case 33:
  164.             return Material.WOOL;
  165.         }
  166.         return Material.STONE;
  167.     }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement