Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. public class LocationUtil {
  2.  
  3. public static void saveLocation(String Path, Location location, Plugin plugin)
  4. {
  5. plugin.getConfig().set(Path + ".X", Integer.valueOf(location.getBlockX()));
  6. plugin.getConfig().set(Path + ".Y", Integer.valueOf(location.getBlockY()));
  7. plugin.getConfig().set(Path + ".Z", Integer.valueOf(location.getBlockZ()));
  8. plugin.getConfig().set(Path + ".Yaw", Float.valueOf(location.getYaw()));
  9. plugin.getConfig().set(Path + ".Pitch", Float.valueOf(location.getPitch()));
  10. plugin.getConfig().set(Path + ".World", location.getWorld().getName());
  11. plugin.saveConfig();
  12. }
  13.  
  14. public static Location getLocation(String Path, Plugin plugin)
  15. {
  16. try
  17. {
  18. return new Location(Bukkit.getWorld(plugin.getConfig().getString(Path + ".World")), plugin.getConfig().getInt(Path + ".X"), plugin.getConfig().getInt(Path + ".Y"), plugin.getConfig().getInt(Path + ".Z"));
  19. }
  20. catch (Exception e) {}
  21. return null;
  22. }
  23.  
  24. public static Location getLocationWithDirection(String Path, Plugin plugin)
  25. {
  26. try
  27. {
  28. return new Location(Bukkit.getWorld(plugin.getConfig().getString(Path + ".World")), plugin.getConfig().getInt(Path + ".X"), plugin.getConfig().getInt(Path + ".Y"), plugin.getConfig().getInt(Path + ".Z"), plugin.getConfig().getInt(Path + ".Yaw"), plugin.getConfig().getInt(Path + ".Pitch"));
  29. }
  30. catch (Exception e) {}
  31. return null;
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement