I'm trying to get a player without color codes with the below code: Code: public static boolean has(Player player, String permission) { String name = ChatColor.stripColor(player.getName()); return player.hasPermission(permission); } The problem I'm having is converting the string into a player. I've tried Bukkit.getPlayer(name), but I get a NullPointerException. Any help?
If you use Bukkit.getPlayer(name) and the player is offline, you may get a NullPointer. Before doing anything to the player you have to check it with something like... Code: Player player = Bukkit.getPlayer(name); if (player != null && player.isOnline()) { //Do whatever with the player here } [EDIT] But as @ferrybig said, you already have a Player object since your method requires you to pass a player to it.