/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/GetposCommand.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/GetposCommand.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/GetposCommand.java revision 1475 by torben, Mon May 23 15:12:25 2011 UTC miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/GetposCommand.java revision 2093 by torben, Sat Dec 7 15:18:04 2013 UTC
# Line 1  Line 1 
1  package dk.thoerup.bukkit.hoeruputils;  package dk.thoerup.bukkit.hoeruputils;
2    
3  import org.bukkit.Location;  import org.bukkit.Location;
4    import org.bukkit.World;
5  import org.bukkit.command.Command;  import org.bukkit.command.Command;
6  import org.bukkit.command.CommandExecutor;  import org.bukkit.command.CommandExecutor;
7  import org.bukkit.command.CommandSender;  import org.bukkit.command.CommandSender;
# Line 17  public class GetposCommand implements Co Line 18  public class GetposCommand implements Co
18                                    
19                  Player p = (Player) sender;                  Player p = (Player) sender;
20                  Location l = p.getLocation();                  Location l = p.getLocation();
21    
22                    World world = l.getWorld();
23                                    
24                    String worldMsg = "You are currently in world: " + world.getName();
25                    p.sendMessage( worldMsg );
26            
27                                    
28                  String message = String.format("Your current location is %d,%d,%d", (int)l.getX(), (int)l.getY(), (int)l.getZ() );                  String message = String.format("Your current location is %d,%d,%d", (int)l.getX(), (int)l.getY(), (int)l.getZ() );
29                  p.sendMessage(message);                  p.sendMessage(message);
30                  p.sendMessage( String.format("%f, %f", l.getPitch(), l.getYaw()) );                  
31                  //needs to print facing direction                  //pitch is how much user is looking up/down
32                    //yaw is left,right looking direction, 0=straight west
33                    
34                    int compass = ( (int)l.getYaw() + 270) % 360;
35                    String compStr = WhereisCommand.getBearingStr(compass);
36                    p.sendMessage( String.format("Facing direction %d (%s)", compass, compStr ) );
37                    //
38                                    
39                  // TODO Auto-generated method stub                  // TODO Auto-generated method stub
40                  return true;                  return true;

Legend:
Removed from v.1475  
changed lines
  Added in v.2093

  ViewVC Help
Powered by ViewVC 1.1.20