Hey there, at the moment im programming a bukkit Plugin. Code: Code:java if(cmd.getName().equalsIgnoreCase("tele")){ if(p != null){ if(p.hasPermission("test.tele")){ if(args.length != 2){ return false; } Player p2 = this.getServer().getPlayer(args[0]); Player target = this.getServer().getPlayer(args[1]); String targetname = target.getDisplayName(); String pname= p2.getDisplayName(); if(target.isOnline() && p2.isOnline()){ Location s = target.getLocation(); p2.teleport(s); p.sendMessage(ChatColor.RED + pname + ChatColor.GREEN + " wurde erfolgrecih zu" + targetname + " teleportiert!"); }else{ p.sendMessage("Not online"); } } }else{ sender.sendMessage("[Test] Sie sind kein Spieler!"); return true; } } this is one of the commands. this is a teleport command. Now when i teleport player who are online, it works but if i type a random name, it wont show the message "Not Online". Instead it shows an error in the console of bukkit... maybe there is 1 return too much? Thank you!
hemran The Variables targetname and pname should be inside of the if-statement. Because they won't have a name if they aren't even online. Also always post any errors you get using Pastebin. Errors are helpful.
hemran Check if the player is null before teleporting. if (p2 == null) { p.sendMessage("Player not found); } else { // teleport