1 |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
3 |
import org.bukkit.Location; |
4 |
import org.bukkit.command.Command; |
5 |
import org.bukkit.command.CommandExecutor; |
6 |
import org.bukkit.command.CommandSender; |
7 |
import org.bukkit.entity.Player; |
8 |
|
9 |
public class GetposCommand implements CommandExecutor { |
10 |
|
11 |
@Override |
12 |
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { |
13 |
if (! (sender instanceof Player) ) { |
14 |
return false; |
15 |
} |
16 |
|
17 |
|
18 |
Player p = (Player) sender; |
19 |
Location l = p.getLocation(); |
20 |
|
21 |
String message = String.format("Your current location is %d,%d,%d", (int)l.getX(), (int)l.getY(), (int)l.getZ() ); |
22 |
p.sendMessage(message); |
23 |
//needs to print facing direction |
24 |
|
25 |
// TODO Auto-generated method stub |
26 |
return true; |
27 |
} |
28 |
|
29 |
} |