mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-06-30 09:49:27 +00:00
81397d98b8
**If it is accepted then I will add it to the other message files.**
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.User;
|
|
import org.bukkit.Server;
|
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
|
|
|
|
|
public class Commandcompass extends EssentialsCommand {
|
|
public Commandcompass() {
|
|
super("compass");
|
|
}
|
|
|
|
@Override
|
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
|
final int bearing = (int) (user.getLocation().getYaw() + 180 + 360) % 360;
|
|
String dir;
|
|
if (bearing < 23) {
|
|
dir = tl("north");
|
|
} else if (bearing < 68) {
|
|
dir = tl("northEast");
|
|
} else if (bearing < 113) {
|
|
dir = tl("east");
|
|
} else if (bearing < 158) {
|
|
dir = tl("southEast");
|
|
} else if (bearing < 203) {
|
|
dir = tl("south");
|
|
} else if (bearing < 248) {
|
|
dir = tl("southWest");
|
|
} else if (bearing < 293) {
|
|
dir = tl("west");
|
|
} else if (bearing < 338) {
|
|
dir = tl("northWest");
|
|
} else {
|
|
dir = tl("north");
|
|
}
|
|
user.sendMessage(tl("compassBearing", dir, bearing));
|
|
}
|
|
}
|