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; } }
private static void setKitDisplayName(Player player, String kitname) { if (plugin.winner(player)) player.setDisplayName( "§8[" + kitname + "] §r" + ChatColor.GOLD + player.getName() + ChatColor.WHITE); else if (player.hasPermission("bg.admin.color") || player.hasPermission("bg.admin.*")) player.setDisplayName( "§8[" + kitname + "] §r" + ChatColor.RED + player.getName() + ChatColor.WHITE); else if (player.hasPermission("bg.vip.color") || player.hasPermission("bg.vip.*")) player.setDisplayName( "§8[" + kitname + "] §r" + ChatColor.BLUE + player.getName() + ChatColor.WHITE); else player.setDisplayName( "§8[" + kitname + "] §r" + ChatColor.WHITE + player.getName() + ChatColor.WHITE); }