summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-15 01:13:24 +0200
committersnowleo <schneeleo@gmail.com>2011-10-15 01:15:01 +0200
commit200ef0c8e23eb4e6603d76e76c511f892fc0c381 (patch)
tree9e83292a3f39e9fc3c5ceae213fb9f4dcc722deb
parent6f77a2ba0759c32d8b865915445b38acd93371f2 (diff)
downloadEssentials-200ef0c8e23eb4e6603d76e76c511f892fc0c381.tar
Essentials-200ef0c8e23eb4e6603d76e76c511f892fc0c381.tar.gz
Essentials-200ef0c8e23eb4e6603d76e76c511f892fc0c381.tar.lz
Essentials-200ef0c8e23eb4e6603d76e76c511f892fc0c381.tar.xz
Essentials-200ef0c8e23eb4e6603d76e76c511f892fc0c381.zip
Correctly fix the N/S direction
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandcompass.java47
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java6
2 files changed, 40 insertions, 13 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
index 8d582a296..eae10f0a5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
@@ -15,17 +15,44 @@ public class Commandcompass extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
- int r = (int)user.getLocation().getYaw();
+ int r = (int)(user.getLocation().getYaw() + 180 + 360) % 360;
String dir;
- if (r < 23) dir = "N";
- else if (r < 68) dir = "NE";
- else if (r < 113) dir = "E";
- else if (r < 158) dir = "SE";
- else if (r < 203) dir = "S";
- else if (r < 248) dir = "SW";
- else if (r < 293) dir = "W";
- else if (r < 338) dir = "NW";
- else dir = "N";
+ if (r < 23)
+ {
+ dir = "N";
+ }
+ else if (r < 68)
+ {
+ dir = "NE";
+ }
+ else if (r < 113)
+ {
+ dir = "E";
+ }
+ else if (r < 158)
+ {
+ dir = "SE";
+ }
+ else if (r < 203)
+ {
+ dir = "S";
+ }
+ else if (r < 248)
+ {
+ dir = "SW";
+ }
+ else if (r < 293)
+ {
+ dir = "W";
+ }
+ else if (r < 338)
+ {
+ dir = "NW";
+ }
+ else
+ {
+ dir = "N";
+ }
user.sendMessage(Util.format("compassBearing", dir, r));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
index 12eeb5182..6f1fd7d6c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
@@ -16,10 +16,10 @@ public class Commandgetpos extends EssentialsCommand
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
Location coords = user.getLocation();
- user.sendMessage("§7X: " + coords.getBlockX() + " (-North <-> +South)");
+ user.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)");
user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
- user.sendMessage("§7Z: " + coords.getBlockZ() + " (+East <-> -West)");
- user.sendMessage("§7Yaw: " + coords.getYaw() + " (Rotation)");
+ user.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)");
+ user.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)");
user.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
}
}