mirror of
https://github.com/essentials/Essentials.git
synced 2025-01-18 13:56:29 +01:00
Correctly fix the N/S direction
This commit is contained in:
parent
5e7523bf20
commit
febb7916dd
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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)");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user