Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String getStringByLocation(Location location, boolean roundNumbers, boolean includePitchAndYaw) {
- String strLocation = (roundNumbers ? "world 0 0 0" + (includePitchAndYaw ? " 0 0" : "") : "world 0.0 0.0 0.0" + (includePitchAndYaw ? " 0.0 0.0" : ""));
- if (location != null) {
- String worldName = "world";
- if (location.getWorld() != null) worldName = "world";
- else worldName = location.getWorld().getName();
- if (roundNumbers) {
- int xPos = (int) location.getX(), yPos = (int) location.getY(), zPos = (int) location.getZ();
- if (includePitchAndYaw) {
- int yaw = (int) location.getYaw(), pitch = (int) location.getPitch();
- strLocation = worldName + " " + xPos + " " + yPos + " " + zPos + " " + yaw + " " + pitch;
- } else {
- strLocation = worldName + " " + xPos + " " + yPos + " " + zPos;
- }
- } else {
- double xPos = location.getX(), yPos = location.getY(), zPos = location.getZ();
- if (includePitchAndYaw) {
- float yaw = location.getYaw(), pitch = location.getPitch();
- strLocation = worldName + " " + xPos + " " + yPos + " " + zPos + " " + yaw + " " + pitch;
- } else {
- strLocation = worldName + " " + xPos + " " + yPos + " " + zPos;
- }
- }
- }
- return strLocation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement