Kewilleen

Untitled

Jul 31st, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.08 KB | None | 0 0
  1. public static void getArmadura(Player p) {
  2.         /* Elmo */
  3.         String[] elmo = cnf.getString("Arena.Itens.Elmo").split(" ");
  4.         ItemStack elmoi = new ItemStack(Material.getMaterial(Integer.parseInt(elmo[0])));
  5.         ItemMeta elmom = elmoi.getItemMeta();
  6.         if (elmo.length > 1) {
  7.             for (int i = 1; i <= elmo.length - 1; i++) {
  8.                 String[] en = elmo[i].split(":");
  9.                 try {
  10.                     elmoi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  11.                 } catch (Exception e) {
  12.                     e.printStackTrace();
  13.                     KwMetodos.getErro(true, false, false, "Arenas");
  14.                 }
  15.             }
  16.         }
  17.         elmoi.setItemMeta(elmom);
  18.  
  19.         /* Peiotal */
  20.         String[] peito = cnf.getString("Arena.Itens.Peitoral").split(" ");
  21.         ItemStack peitoi = new ItemStack(Material.getMaterial(Integer.parseInt(peito[0])));
  22.         ItemMeta peitom = peitoi.getItemMeta();
  23.         if (peito.length > 1) {
  24.             for (int i = 1; i <= peito.length - 1; i++) {
  25.                 String[] en = peito[i].split(":");
  26.                 try {
  27.                     peitoi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  28.                 } catch (Exception e) {
  29.                     e.printStackTrace();
  30.                     KwMetodos.getErro(true, false, false, "Arenas");
  31.                 }
  32.             }
  33.         }
  34.         peitoi.setItemMeta(peitom);
  35.  
  36.         /* Calca */
  37.         String[] legg = cnf.getString("Arena.Itens.Leggs").split(" ");
  38.         ItemStack leggi = new ItemStack(Material.getMaterial(Integer.parseInt(legg[0])));
  39.         ItemMeta leggm = leggi.getItemMeta();
  40.         if (legg.length > 1) {
  41.             for (int i = 1; i <= legg.length - 1; i++) {
  42.                 String[] en = legg[i].split(":");
  43.                 try {
  44.                     leggi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  45.                 } catch (Exception e) {
  46.                     e.printStackTrace();
  47.                     KwMetodos.getErro(true, false, false, "Arenas");
  48.                 }
  49.             }
  50.         }
  51.         leggi.setItemMeta(leggm);
  52.  
  53.         /* Bota */
  54.         String[] bota = cnf.getString("Arena.Itens.Bota").split(" ");
  55.         ItemStack botai = new ItemStack(Material.getMaterial(Integer.parseInt(bota[0])));
  56.         ItemMeta botam = botai.getItemMeta();
  57.         if (bota.length > 1) {
  58.             for (int i = 1; i <= bota.length - 1; i++) {
  59.                 String[] en = bota[i].split(":");
  60.                 try {
  61.                     botai.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  62.                 } catch (Exception e) {
  63.                     e.printStackTrace();
  64.                     KwMetodos.getErro(true, false, false, "Arenas");
  65.                 }
  66.             }
  67.         }
  68.         botai.setItemMeta(botam);
  69.         /* VIP */
  70.         /* Elmo */
  71.         String[] elmovip = cnf.getString("Arena.VIP.Elmo").split(" ");
  72.         ItemStack elmovipi = new ItemStack(Material.getMaterial(Integer.parseInt(elmovip[0])));
  73.         ItemMeta elmovipm = elmovipi.getItemMeta();
  74.         if (elmovip.length > 1) {
  75.             for (int i = 1; i <= elmovip.length - 1; i++) {
  76.                 String[] en = elmovip[i].split(":");
  77.                 elmovipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  78.             }
  79.         }
  80.         elmovipi.setItemMeta(elmovipm);
  81.  
  82.         String[] peitovip = cnf.getString("Arena.VIP.Peitoral").split(" ");
  83.         ItemStack peitovipi = new ItemStack(Material.getMaterial(Integer.parseInt(peitovip[0])));
  84.         ItemMeta peitovipm = peitovipi.getItemMeta();
  85.         if (peitovip.length > 1) {
  86.             for (int i = 1; i <= peitovip.length - 1; i++) {
  87.                 String[] en = peitovip[i].split(":");
  88.                 peitovipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  89.             }
  90.         }
  91.         peitovipi.setItemMeta(peitovipm);
  92.  
  93.         String[] leggsvip = cnf.getString("Arena.VIP.Leggs").split(" ");
  94.         ItemStack leggsvipi = new ItemStack(Material.getMaterial(Integer.parseInt(leggsvip[0])));
  95.         ItemMeta leggsvipm = leggsvipi.getItemMeta();
  96.         if (leggsvip.length > 1) {
  97.             for (int i = 1; i <= leggsvip.length - 1; i++) {
  98.                 String[] en = leggsvip[i].split(":");
  99.                 leggsvipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  100.             }
  101.         }
  102.         leggsvipi.setItemMeta(leggsvipm);
  103.  
  104.         String[] botavip = cnf.getString("Arena.VIP.Bota").split(" ");
  105.         ItemStack botavipi = new ItemStack(Material.getMaterial(Integer.parseInt(botavip[0])));
  106.         ItemMeta botavipm = botavipi.getItemMeta();
  107.         if (botavip.length > 1) {
  108.             for (int i = 1; i <= botavip.length - 1; i++) {
  109.                 String[] en = botavip[i].split(":");
  110.                 botavipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
  111.             }
  112.         }
  113.         botavipi.setItemMeta(botavipm);
  114.         if ((p.hasPermission("kwarena.admin") || (p.hasPermission(KwMetodos.getCnf("Arena.VIP.Permissao_VIP"))))) {
  115.             p.getInventory().setBoots(botavipi);
  116.             p.getInventory().setLeggings(leggsvipi);
  117.             p.getInventory().setChestplate(peitovipi);
  118.             p.getInventory().setHelmet(elmovipi);
  119.         } else {
  120.             p.getInventory().setBoots(botai);
  121.             p.getInventory().setLeggings(leggi);
  122.             p.getInventory().setChestplate(peitoi);
  123.             p.getInventory().setHelmet(elmoi);
  124.         }
  125.     }
  126. //Caso precise do getEncantamentos
  127. public static Enchantment getEncantamento(String nome) {
  128.         if ((nome.equalsIgnoreCase("sharpness")) || (nome.equalsIgnoreCase("s"))) {
  129.             return Enchantment.DAMAGE_ALL;
  130.         }
  131.         if (nome.equalsIgnoreCase("bane_of_arthropods")) {
  132.             return Enchantment.DAMAGE_ARTHROPODS;
  133.         }
  134.         if (nome.equalsIgnoreCase("smite")) {
  135.             return Enchantment.DAMAGE_UNDEAD;
  136.         }
  137.         if ((nome.equalsIgnoreCase("efficiency")) || (nome.equalsIgnoreCase("effy"))) {
  138.             return Enchantment.DIG_SPEED;
  139.         }
  140.         if ((nome.equalsIgnoreCase("unbreaking")) || (nome.equalsIgnoreCase("umb"))) {
  141.             return Enchantment.DURABILITY;
  142.         }
  143.         if (nome.equalsIgnoreCase("fire_aspect")) {
  144.             return Enchantment.FIRE_ASPECT;
  145.         }
  146.         if (nome.equalsIgnoreCase("knockback")) {
  147.             return Enchantment.KNOCKBACK;
  148.         }
  149.         if (nome.equalsIgnoreCase("fortune")) {
  150.             return Enchantment.LOOT_BONUS_BLOCKS;
  151.         }
  152.         if (nome.equalsIgnoreCase("looting")) {
  153.             return Enchantment.LOOT_BONUS_MOBS;
  154.         }
  155.         if (nome.equalsIgnoreCase("respiration")) {
  156.             return Enchantment.OXYGEN;
  157.         }
  158.         if ((nome.equalsIgnoreCase("protection")) || (nome.equalsIgnoreCase("p"))) {
  159.             return Enchantment.PROTECTION_ENVIRONMENTAL;
  160.         }
  161.         if (nome.equalsIgnoreCase("blast_protection")) {
  162.             return Enchantment.PROTECTION_EXPLOSIONS;
  163.         }
  164.         if (nome.equalsIgnoreCase("feather_falling")) {
  165.             return Enchantment.PROTECTION_FALL;
  166.         }
  167.         if (nome.equalsIgnoreCase("fire_protection")) {
  168.             return Enchantment.PROTECTION_FIRE;
  169.         }
  170.         if (nome.equalsIgnoreCase("projectile_protection")) {
  171.             return Enchantment.PROTECTION_PROJECTILE;
  172.         }
  173.         if (nome.equalsIgnoreCase("silk_touch")) {
  174.             return Enchantment.SILK_TOUCH;
  175.         }
  176.         if (nome.equalsIgnoreCase("aqua_affinity")) {
  177.             return Enchantment.WATER_WORKER;
  178.         }
  179.         if (nome.equalsIgnoreCase("flame")) {
  180.             return Enchantment.ARROW_FIRE;
  181.         }
  182.         if (nome.equalsIgnoreCase("power")) {
  183.             return Enchantment.ARROW_DAMAGE;
  184.         }
  185.         if (nome.equalsIgnoreCase("punch")) {
  186.             return Enchantment.ARROW_KNOCKBACK;
  187.         }
  188.         if (nome.equalsIgnoreCase("infinity")) {
  189.             return Enchantment.ARROW_INFINITE;
  190.         }
  191.         return null;
  192.     }
  193.  
  194. config.yml:
  195.  #Entrar com itens proprios do plugin
  196.   Itens:
  197.     Ativar: true
  198.     Elmo: 310 p:4 umb:3
  199.     Peitoral: 311 p:4 umb:3
  200.     Leggs: 312 p:4 umb:3
  201.     Bota: 313 p:4 umb:3
  202.   VIP:
  203.     Permissao_VIP: "kwarena.vip"
  204.     Elmo: 310 p:6 umb:6
  205.     Peitoral: 311 p:6 umb:6
  206.     Leggs: 312 p:6 umb:6
  207.     Bota: 313 p:6 umb:6
Advertisement
Add Comment
Please, Sign In to add comment