Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void getArmadura(Player p) {
- /* Elmo */
- String[] elmo = cnf.getString("Arena.Itens.Elmo").split(" ");
- ItemStack elmoi = new ItemStack(Material.getMaterial(Integer.parseInt(elmo[0])));
- ItemMeta elmom = elmoi.getItemMeta();
- if (elmo.length > 1) {
- for (int i = 1; i <= elmo.length - 1; i++) {
- String[] en = elmo[i].split(":");
- try {
- elmoi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- } catch (Exception e) {
- e.printStackTrace();
- KwMetodos.getErro(true, false, false, "Arenas");
- }
- }
- }
- elmoi.setItemMeta(elmom);
- /* Peiotal */
- String[] peito = cnf.getString("Arena.Itens.Peitoral").split(" ");
- ItemStack peitoi = new ItemStack(Material.getMaterial(Integer.parseInt(peito[0])));
- ItemMeta peitom = peitoi.getItemMeta();
- if (peito.length > 1) {
- for (int i = 1; i <= peito.length - 1; i++) {
- String[] en = peito[i].split(":");
- try {
- peitoi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- } catch (Exception e) {
- e.printStackTrace();
- KwMetodos.getErro(true, false, false, "Arenas");
- }
- }
- }
- peitoi.setItemMeta(peitom);
- /* Calca */
- String[] legg = cnf.getString("Arena.Itens.Leggs").split(" ");
- ItemStack leggi = new ItemStack(Material.getMaterial(Integer.parseInt(legg[0])));
- ItemMeta leggm = leggi.getItemMeta();
- if (legg.length > 1) {
- for (int i = 1; i <= legg.length - 1; i++) {
- String[] en = legg[i].split(":");
- try {
- leggi.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- } catch (Exception e) {
- e.printStackTrace();
- KwMetodos.getErro(true, false, false, "Arenas");
- }
- }
- }
- leggi.setItemMeta(leggm);
- /* Bota */
- String[] bota = cnf.getString("Arena.Itens.Bota").split(" ");
- ItemStack botai = new ItemStack(Material.getMaterial(Integer.parseInt(bota[0])));
- ItemMeta botam = botai.getItemMeta();
- if (bota.length > 1) {
- for (int i = 1; i <= bota.length - 1; i++) {
- String[] en = bota[i].split(":");
- try {
- botai.addEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- } catch (Exception e) {
- e.printStackTrace();
- KwMetodos.getErro(true, false, false, "Arenas");
- }
- }
- }
- botai.setItemMeta(botam);
- /* VIP */
- /* Elmo */
- String[] elmovip = cnf.getString("Arena.VIP.Elmo").split(" ");
- ItemStack elmovipi = new ItemStack(Material.getMaterial(Integer.parseInt(elmovip[0])));
- ItemMeta elmovipm = elmovipi.getItemMeta();
- if (elmovip.length > 1) {
- for (int i = 1; i <= elmovip.length - 1; i++) {
- String[] en = elmovip[i].split(":");
- elmovipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- }
- }
- elmovipi.setItemMeta(elmovipm);
- String[] peitovip = cnf.getString("Arena.VIP.Peitoral").split(" ");
- ItemStack peitovipi = new ItemStack(Material.getMaterial(Integer.parseInt(peitovip[0])));
- ItemMeta peitovipm = peitovipi.getItemMeta();
- if (peitovip.length > 1) {
- for (int i = 1; i <= peitovip.length - 1; i++) {
- String[] en = peitovip[i].split(":");
- peitovipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- }
- }
- peitovipi.setItemMeta(peitovipm);
- String[] leggsvip = cnf.getString("Arena.VIP.Leggs").split(" ");
- ItemStack leggsvipi = new ItemStack(Material.getMaterial(Integer.parseInt(leggsvip[0])));
- ItemMeta leggsvipm = leggsvipi.getItemMeta();
- if (leggsvip.length > 1) {
- for (int i = 1; i <= leggsvip.length - 1; i++) {
- String[] en = leggsvip[i].split(":");
- leggsvipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- }
- }
- leggsvipi.setItemMeta(leggsvipm);
- String[] botavip = cnf.getString("Arena.VIP.Bota").split(" ");
- ItemStack botavipi = new ItemStack(Material.getMaterial(Integer.parseInt(botavip[0])));
- ItemMeta botavipm = botavipi.getItemMeta();
- if (botavip.length > 1) {
- for (int i = 1; i <= botavip.length - 1; i++) {
- String[] en = botavip[i].split(":");
- botavipi.addUnsafeEnchantment(KwMetodos.getEncantamento(en[0]), Integer.parseInt(en[1]));
- }
- }
- botavipi.setItemMeta(botavipm);
- if ((p.hasPermission("kwarena.admin") || (p.hasPermission(KwMetodos.getCnf("Arena.VIP.Permissao_VIP"))))) {
- p.getInventory().setBoots(botavipi);
- p.getInventory().setLeggings(leggsvipi);
- p.getInventory().setChestplate(peitovipi);
- p.getInventory().setHelmet(elmovipi);
- } else {
- p.getInventory().setBoots(botai);
- p.getInventory().setLeggings(leggi);
- p.getInventory().setChestplate(peitoi);
- p.getInventory().setHelmet(elmoi);
- }
- }
- //Caso precise do getEncantamentos
- public static Enchantment getEncantamento(String nome) {
- if ((nome.equalsIgnoreCase("sharpness")) || (nome.equalsIgnoreCase("s"))) {
- return Enchantment.DAMAGE_ALL;
- }
- if (nome.equalsIgnoreCase("bane_of_arthropods")) {
- return Enchantment.DAMAGE_ARTHROPODS;
- }
- if (nome.equalsIgnoreCase("smite")) {
- return Enchantment.DAMAGE_UNDEAD;
- }
- if ((nome.equalsIgnoreCase("efficiency")) || (nome.equalsIgnoreCase("effy"))) {
- return Enchantment.DIG_SPEED;
- }
- if ((nome.equalsIgnoreCase("unbreaking")) || (nome.equalsIgnoreCase("umb"))) {
- return Enchantment.DURABILITY;
- }
- if (nome.equalsIgnoreCase("fire_aspect")) {
- return Enchantment.FIRE_ASPECT;
- }
- if (nome.equalsIgnoreCase("knockback")) {
- return Enchantment.KNOCKBACK;
- }
- if (nome.equalsIgnoreCase("fortune")) {
- return Enchantment.LOOT_BONUS_BLOCKS;
- }
- if (nome.equalsIgnoreCase("looting")) {
- return Enchantment.LOOT_BONUS_MOBS;
- }
- if (nome.equalsIgnoreCase("respiration")) {
- return Enchantment.OXYGEN;
- }
- if ((nome.equalsIgnoreCase("protection")) || (nome.equalsIgnoreCase("p"))) {
- return Enchantment.PROTECTION_ENVIRONMENTAL;
- }
- if (nome.equalsIgnoreCase("blast_protection")) {
- return Enchantment.PROTECTION_EXPLOSIONS;
- }
- if (nome.equalsIgnoreCase("feather_falling")) {
- return Enchantment.PROTECTION_FALL;
- }
- if (nome.equalsIgnoreCase("fire_protection")) {
- return Enchantment.PROTECTION_FIRE;
- }
- if (nome.equalsIgnoreCase("projectile_protection")) {
- return Enchantment.PROTECTION_PROJECTILE;
- }
- if (nome.equalsIgnoreCase("silk_touch")) {
- return Enchantment.SILK_TOUCH;
- }
- if (nome.equalsIgnoreCase("aqua_affinity")) {
- return Enchantment.WATER_WORKER;
- }
- if (nome.equalsIgnoreCase("flame")) {
- return Enchantment.ARROW_FIRE;
- }
- if (nome.equalsIgnoreCase("power")) {
- return Enchantment.ARROW_DAMAGE;
- }
- if (nome.equalsIgnoreCase("punch")) {
- return Enchantment.ARROW_KNOCKBACK;
- }
- if (nome.equalsIgnoreCase("infinity")) {
- return Enchantment.ARROW_INFINITE;
- }
- return null;
- }
- config.yml:
- #Entrar com itens proprios do plugin
- Itens:
- Ativar: true
- Elmo: 310 p:4 umb:3
- Peitoral: 311 p:4 umb:3
- Leggs: 312 p:4 umb:3
- Bota: 313 p:4 umb:3
- VIP:
- Permissao_VIP: "kwarena.vip"
- Elmo: 310 p:6 umb:6
- Peitoral: 311 p:6 umb:6
- Leggs: 312 p:6 umb:6
- Bota: 313 p:6 umb:6
Advertisement
Add Comment
Please, Sign In to add comment