Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. package lisener;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import org.bukkit.configuration.file.YamlConfiguration;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.player.PlayerCommandPreprocessEvent;
  11.  
  12. import main.data;
  13.  
  14. public class nav implements Listener{
  15.  
  16. @EventHandler
  17. public void onPlayer(PlayerCommandPreprocessEvent e) {
  18. Player p = e.getPlayer();
  19. if(e.getMessage().equalsIgnoreCase("/setspawn1")) {
  20. if(p.hasPermission("lobby.admin")) {
  21. File file = new File("plugin//Lobby//spawns.yml");
  22. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  23. cfg.set("Spawn1.X", p.getLocation().getX());
  24. cfg.set("Spawn1.Y", p.getLocation().getY());
  25. cfg.set("Spawn1.Z", p.getLocation().getZ());
  26. cfg.set("Spawn1.Yaw", p.getLocation().getYaw());
  27. cfg.set("Spawn1.Pitch", p.getLocation().getPitch());
  28. cfg.set("Spawn1.WeltName",p.getWorld().getName());
  29. try {
  30. cfg.save(file);
  31. } catch (IOException e1) {
  32. p.sendMessage(data.error);
  33. }
  34. p.sendMessage(data.sp);
  35. }else{
  36. p.sendMessage(data.noperms);
  37. }
  38.  
  39. }else if (e.getMessage().equalsIgnoreCase("/setspawn2")) {
  40. if(p.hasPermission("lobby.admin")) {
  41. File file = new File("plugin//Lobby//spawns.yml");
  42. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  43. cfg.set("Spawn2.X", p.getLocation().getX());
  44. cfg.set("Spawn2.Y", p.getLocation().getY());
  45. cfg.set("Spawn2.Z", p.getLocation().getZ());
  46. cfg.set("Spawn2.Yaw", p.getLocation().getYaw());
  47. cfg.set("Spawn2.Pitch", p.getLocation().getPitch());
  48. cfg.set("Spawn2.WeltName",p.getWorld().getName());
  49. try {
  50. cfg.save(file);
  51. } catch (IOException e1) {
  52. p.sendMessage(data.error);
  53. }
  54. p.sendMessage(data.sp);
  55.  
  56. }else if (e.getMessage().equalsIgnoreCase("/setspawn3")) {
  57. if(p.hasPermission("lobby.admin")) {
  58. File file = new File("plugin//Lobby//spawns.yml");
  59. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  60. cfg.set("Spawn3.X", p.getLocation().getX());
  61. cfg.set("Spawn3.Y", p.getLocation().getY());
  62. cfg.set("Spawn3.Z", p.getLocation().getZ());
  63. cfg.set("Spawn3.Yaw", p.getLocation().getYaw());
  64. cfg.set("Spawn3.Pitch", p.getLocation().getPitch());
  65. cfg.set("Spawn3.WeltName",p.getWorld().getName());
  66. try {
  67. cfg.save(file);
  68. } catch (IOException e1) {
  69. p.sendMessage(data.error);
  70. }
  71. p.sendMessage(data.sp);
  72.  
  73. }else if (e.getMessage().equalsIgnoreCase("/setspawn4")) {
  74. if(p.hasPermission("lobby.admin")) {
  75. File file = new File("plugin//Lobby//spawns.yml");
  76. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  77. cfg.set("Spawn4.X", p.getLocation().getX());
  78. cfg.set("Spawn4.Y", p.getLocation().getY());
  79. cfg.set("Spawn4.Z", p.getLocation().getZ());
  80. cfg.set("Spawn4.Yaw", p.getLocation().getYaw());
  81. cfg.set("Spawn4.Pitch", p.getLocation().getPitch());
  82. cfg.set("Spawn4.WeltName",p.getWorld().getName());
  83. try {
  84. cfg.save(file);
  85. } catch (IOException e1) {
  86. p.sendMessage(data.error);
  87. }
  88. p.sendMessage(data.sp);
  89.  
  90. }else if (e.getMessage().equalsIgnoreCase("/setspawn5")) {
  91. if(p.hasPermission("lobby.admin")) {
  92. File file = new File("plugin//Lobby//spawns.yml");
  93. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  94. cfg.set("Spawn5.X", p.getLocation().getX());
  95. cfg.set("Spawn5.Y", p.getLocation().getY());
  96. cfg.set("Spawn5.Z", p.getLocation().getZ());
  97. cfg.set("Spawn5.Yaw", p.getLocation().getYaw());
  98. cfg.set("Spawn5.Pitch", p.getLocation().getPitch());
  99. cfg.set("Spawn5.WeltName",p.getWorld().getName());
  100. try {
  101. cfg.save(file);
  102. } catch (IOException e1) {
  103. p.sendMessage(data.error);
  104. }
  105. p.sendMessage(data.sp);
  106. }else{
  107. p.sendMessage(data.noperms);
  108. }
  109.  
  110.  
  111.  
  112.  
  113. }
  114.  
  115.  
  116.  
  117. }
  118.  
  119.  
  120.  
  121. }
  122.  
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement