--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/WhereisCommand.java 2011/05/18 19:08:29 1470 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/WhereisCommand.java 2015/03/09 13:55:54 2432 @@ -19,16 +19,14 @@ @Override public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage("Whereis: What are you"); - return true; - } + if (args.length != 1) { sender.sendMessage("Usage: /whereis "); return true; } + @SuppressWarnings("deprecation")//user by name is our only option here Player target = server.getPlayer(args[0]); if (target == null) { @@ -36,9 +34,14 @@ return true; } - Location targetLoc = target.getLocation(); + Location targetLoc = target.getLocation(); Player player = (Player) sender; + if (player.getLocation().getWorld() != targetLoc.getWorld()) { + sender.sendMessage("Whereis: player " + args[0] + " is in another world: " + targetLoc.getWorld().getName() ); + return true; + } + int dist = calcDistance(player.getLocation(), targetLoc); int bearing = calcBearing(player.getLocation(), targetLoc);