1 |
package dk.thoerup.bukkit.hoeruputils; |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
|
3 |
|
import org.bukkit.ChatColor; |
4 |
import org.bukkit.Location; |
import org.bukkit.Location; |
5 |
import org.bukkit.Server; |
import org.bukkit.Server; |
6 |
import org.bukkit.command.Command; |
import org.bukkit.command.Command; |
36 |
return true; |
return true; |
37 |
} |
} |
38 |
|
|
39 |
Location targetLoc = target.getLocation(); |
Location targetLoc = target.getLocation(); |
40 |
Player player = (Player) sender; |
Player player = (Player) sender; |
41 |
|
|
42 |
|
if (player.getLocation().getWorld() != targetLoc.getWorld()) { |
43 |
|
sender.sendMessage("Whereis: player " + args[0] + " is in another world: " + targetLoc.getWorld().getName() ); |
44 |
|
return true; |
45 |
|
} |
46 |
|
|
47 |
int dist = calcDistance(player.getLocation(), targetLoc); |
int dist = calcDistance(player.getLocation(), targetLoc); |
48 |
int bearing = calcBearing(player.getLocation(), targetLoc); |
int bearing = calcBearing(player.getLocation(), targetLoc); |
49 |
|
|
50 |
|
|
51 |
target.sendMessage("Whereis: you are tracked by " + player.getName() ); |
//target.sendMessage("Whereis: you are tracked by " + player.getName() ); |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
player.sendMessage("Whereis: " + target.getName() + " is at " + (int)targetLoc.getX() + "," + (int)targetLoc.getY() + "," +(int)targetLoc.getZ() ); |
player.sendMessage( ChatColor.WHITE + String.format("Whereis: %s is at %d,%d,%d", target.getName(), (int)targetLoc.getX(), (int)targetLoc.getY(), (int)targetLoc.getZ()) ); |
56 |
player.sendMessage("Distance: " + dist + ", bearing: " + bearing + "(" + getBearingStr(bearing) + ")" ); |
player.sendMessage( ChatColor.WHITE + "Distance: " + dist + ", bearing: " + bearing + "(" + getBearingStr(bearing) + ")" ); |
57 |
|
|
58 |
return true; |
return true; |
59 |
} |
} |