Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. public void setSpawn(Player p) {
  2. if (p.hasPermission("Skypvp.admin")) {
  3. String path = "SpawnLocation.spawn";
  4. Location loc = p.getLocation();
  5. String world = loc.getWorld().getName();
  6. double x = loc.getX();
  7. double y = loc.getY();
  8. double z = loc.getZ();
  9. double yaw = loc.getYaw();
  10. double pitch = loc.getPitch();
  11.  
  12. FileConfiguration cfg = main.getConfig();
  13.  
  14. cfg.set(path + ".World", world);
  15. cfg.set(path + ".PosX", Double.valueOf(x));
  16. cfg.set(path + ".PosY", Double.valueOf(y));
  17. cfg.set(path + ".PosZ", Double.valueOf(z));
  18. cfg.set(path + ".PosYaw", Double.valueOf(yaw));
  19. cfg.set(path + ".PosPitch", Double.valueOf(pitch));
  20. main.saveConfig();
  21. p.sendMessage(Main.Prefix + "§6§lDu hast den SkyPvP Welt Spawn gesetzt!");
  22. } else {
  23. p.sendMessage(Main.Prefix + "§c§lDu hast keine Berechtigung dazu!");
  24. }
  25. }
  26.  
  27. public static void tpSpawn(Player p) {
  28. FileConfiguration cfg = main.getConfig();
  29.  
  30. String path = "SpawnLocation.spawn";
  31. if (cfg.contains(path)) {
  32. double x = cfg.getDouble(path + ".PosX");
  33. double y = cfg.getDouble(path + ".PosY");
  34. double z = cfg.getDouble(path + ".PosZ");
  35. double yaw = cfg.getDouble(path + ".PosYaw");
  36. double pitch = cfg.getDouble(path + ".PosPitch");
  37. String world = cfg.getString(path + ".World");
  38. Location loc = new Location(Bukkit.getWorld(world), x, y, z, (float)yaw, (float)pitch);
  39. p.teleport(loc);
  40. }
  41. else {
  42. p.sendMessage(Main.Prefix + "§7§lEs wurde noch kein Spawn Punkt gesetzt.");
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement