public static void setKit(Player player, String kitname) { kitname = kitname.toLowerCase(); kitname = kitname.replace(".", ""); ConfigurationSection kit = BGFiles.kitconf.getConfigurationSection(kitname); if (kit == null && !kits.contains(kitname)) { BGChat.printPlayerChat(player, "That kit doesn't exist!"); return; } if (KIT.get(player) == kitname) return; if (player.hasPermission("bg.kit." + kitname) || player.hasPermission("bg.kit.*") || (plugin.SIMP_REW && plugin.winner(player)) || (plugin.REW && plugin.reward.BOUGHT_KITS.get(player.getName()) != null && plugin.reward.BOUGHT_KITS.get(player.getName()).equals(kitname))) { if (KIT.containsKey(player)) { KIT.remove(player); } KIT.put(player, kitname); char[] stringArray = kitname.toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); kitname = new String(stringArray); BGChat.printPlayerChat(player, "You have chosen " + kitname + " as your kit."); setKitDisplayName(player, kitname); } else { BGChat.printPlayerChat(player, plugin.NO_KIT_MSG); return; } }
public void spawnTable(Location l) { l.getBlock().setType(Material.ENCHANTMENT_TABLE); DecimalFormat df = new DecimalFormat("##.#"); BGChat.printInfoChat( "Enchantment Table spawned at X: " + df.format(l.getX()) + " | Y: " + df.format(l.getY()) + " | Z: " + df.format(l.getZ())); }
public void spawnChest(Location l) { l.getBlock().setType(Material.CHEST); Chest c = (Chest) l.getBlock().getState(); List<String> items = BGFiles.chestconf.getStringList("ITEMS"); for (String item : items) { Random r = new Random(); String[] oneitem = item.split(","); if (Boolean.parseBoolean(oneitem[3]) || r.nextBoolean()) { ItemStack i; Integer id = Integer.valueOf(Integer.parseInt(oneitem[0])); Integer minAmount = Integer.valueOf(Integer.parseInt(oneitem[1])); Integer maxAmount = Integer.valueOf(Integer.parseInt(oneitem[2])); Integer amount = r.nextInt((maxAmount + 1) - minAmount) + minAmount; i = new ItemStack(id.intValue(), amount.intValue()); if (oneitem.length == 6) { i.addUnsafeEnchantment( Enchantment.getById(Integer.parseInt(oneitem[4])), Integer.parseInt(oneitem[5])); } c.getInventory().addItem(new ItemStack[] {i}); } } c.update(true); DecimalFormat df = new DecimalFormat("##.#"); BGChat.printInfoChat( "Chest spawned at X: " + df.format(l.getX()) + " | Y: " + df.format(l.getY()) + " | Z: " + df.format(l.getZ())); }