Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.52 KB | None | 0 0
  1. package online.pixelbuilt.pixelbuiltgyms.Kanto;
  2.  
  3. import com.flowpowered.math.vector.Vector3d;
  4. import config.AccountManagerGyms;
  5. import ninja.leaping.configurate.ConfigurationNode;
  6. import online.pixelbuilt.pixelbuiltgyms.PixelBuiltGyms;
  7. import org.spongepowered.api.Sponge;
  8. import org.spongepowered.api.block.BlockSnapshot;
  9. import org.spongepowered.api.block.BlockTypes;
  10. import org.spongepowered.api.command.CommandManager;
  11. import org.spongepowered.api.entity.Transform;
  12. import org.spongepowered.api.entity.living.player.Player;
  13. import org.spongepowered.api.event.Listener;
  14. import org.spongepowered.api.event.block.InteractBlockEvent;
  15. import org.spongepowered.api.event.entity.MoveEntityEvent;
  16. import org.spongepowered.api.event.filter.cause.Root;
  17. import org.spongepowered.api.text.Text;
  18. import org.spongepowered.api.text.format.TextColors;
  19. import org.spongepowered.api.world.Location;
  20. import org.spongepowered.api.world.World;
  21.  
  22. import java.util.Random;
  23. import java.util.UUID;
  24.  
  25.  
  26. public class vermilionGym {
  27.  
  28. public vermilionGym(PixelBuiltGyms plugin) {
  29. this.plugin = plugin;
  30. }
  31.  
  32. public PixelBuiltGyms plugin;
  33.  
  34. public ConfigurationNode config;
  35.  
  36. public AccountManagerGyms accountManagerGyms;
  37.  
  38. @Listener
  39. public void onRightClickonTrashCan(InteractBlockEvent.Secondary.MainHand event, @Root Player player) {
  40. UUID uuid = player.getUniqueId();
  41. accountManagerGyms = new AccountManagerGyms(plugin);
  42. Location<World> playerloc = player.getLocation();
  43. Location<World> eventLoc = event.getTargetBlock().getLocation().get();
  44. CommandManager cmdManager = Sponge.getCommandManager();
  45. BlockSnapshot block = event.getTargetBlock();
  46. ConfigurationNode node = accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans");
  47. String playername = player.getName();
  48.  
  49. if (block.getState().getType().getName().contains("pixelmon:trash_can")) {
  50. if (!player.hasPermission("first.gate")) {
  51. if (playerloc.getBlockX() >= -1021) {
  52. if (playerloc.getBlockX() <= -1009) {
  53. if (node.getValue().equals(1)) {
  54. if (eventLoc.getBlockX() == -1020) {
  55. if (eventLoc.getBlockZ() == -1803) {
  56. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  57. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  58. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  59. } else {
  60. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  61. }
  62. } else {
  63. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  64. }
  65. } else if (node.getValue().equals(2)) {
  66. if (eventLoc.getBlockX() == -1018) {
  67. if (eventLoc.getBlockZ() == -1803) {
  68. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  69. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  70. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  71. } else {
  72. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  73. }
  74. } else {
  75. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  76. }
  77. } else if (node.getValue().equals(3)) {
  78. if (eventLoc.getBlockX() == -1016) {
  79. if (eventLoc.getBlockZ() == -1803) {
  80. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  81. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  82. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  83. } else {
  84. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  85. }
  86. } else {
  87. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  88. }
  89. } else if (node.getValue().equals(4)) {
  90. if (eventLoc.getBlockX() == -1014) {
  91. if (eventLoc.getBlockZ() == -1803) {
  92. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  93. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  94. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  95. } else {
  96. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  97. }
  98. } else {
  99. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  100. }
  101. } else if (node.getValue().equals(5)) {
  102. if (eventLoc.getBlockX() == -1012) {
  103. if (eventLoc.getBlockZ() == -1803) {
  104. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  105. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  106. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  107. } else {
  108. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  109. }
  110. } else {
  111. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  112. }
  113. } else if (node.getValue().equals(6)) {
  114. if (eventLoc.getBlockX() == -1020) {
  115. if (eventLoc.getBlockZ() == -1801) {
  116. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  117. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  118. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  119. } else {
  120. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  121. }
  122. } else {
  123. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  124. }
  125. } else if (node.getValue().equals(7)) {
  126. if (eventLoc.getBlockX() == -1018) {
  127. if (eventLoc.getBlockZ() == -1801) {
  128. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  129. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  130. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  131. } else {
  132. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  133. }
  134. } else {
  135. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  136. }
  137. } else if (node.getValue().equals(8)) {
  138. if (eventLoc.getBlockX() == -1016) {
  139. if (eventLoc.getBlockZ() == -1801) {
  140. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  141. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  142. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  143. } else {
  144. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  145. }
  146. } else {
  147. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  148. }
  149. } else if (node.getValue().equals(9)) {
  150. if (eventLoc.getBlockX() == -1014) {
  151. if (eventLoc.getBlockZ() == -1801) {
  152. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  153. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  154. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  155. } else {
  156. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  157. }
  158. } else {
  159. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  160. }
  161. } else if (node.getValue().equals(10)) {
  162. if (eventLoc.getBlockX() == -1012) {
  163. if (eventLoc.getBlockZ() == -1801) {
  164. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  165. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  166. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  167. } else {
  168. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  169. }
  170. } else {
  171. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  172. }
  173. } else if (node.getValue().equals(11)) {
  174. if (eventLoc.getBlockX() == -1020) {
  175. if (eventLoc.getBlockZ() == -1799) {
  176. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  177. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  178. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  179. } else {
  180. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  181. }
  182. } else {
  183. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  184. }
  185.  
  186. } else if (node.getValue().equals(12)) {
  187. if (eventLoc.getBlockX() == -1018) {
  188. if (eventLoc.getBlockZ() == -1799) {
  189. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  190. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  191. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  192. } else {
  193. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  194. }
  195. } else {
  196. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  197. }
  198.  
  199. } else if (node.getValue().equals(13)) {
  200. if (eventLoc.getBlockX() == -1016) {
  201. if (eventLoc.getBlockZ() == -1799) {
  202. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  203. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  204. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  205. } else {
  206. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  207. }
  208. } else {
  209. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  210. }
  211. } else if (node.getValue().equals(14)) {
  212. if (eventLoc.getBlockX() == -1014) {
  213. if (eventLoc.getBlockZ() == -1799) {
  214. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  215. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  216. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  217. } else {
  218. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  219. }
  220. } else {
  221. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  222. }
  223. } else if (node.getValue().equals(15)) {
  224. if (eventLoc.getBlockX() == -1012) {
  225. if (eventLoc.getBlockZ() == -1799) {
  226. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set first.gate true");
  227. player.sendMessage(Text.of(TextColors.GREEN, ("Hey! There's a switch under the trash! Turn it on!")));
  228. player.sendMessage(Text.of(TextColors.GREEN, ("The first electric lock opened!")));
  229. } else {
  230. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  231. }
  232. } else {
  233. player.sendMessage(Text.of(TextColors.RED, ("Nope! There's only trash here.")));
  234. }
  235. }
  236. }
  237. }
  238. } else {
  239. if (!player.hasPermission("second.gate")) {
  240. ConfigurationNode node1 = accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord");
  241. ConfigurationNode node2 = accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord");
  242. if (node1.getValue().equals(eventLoc.getBlockX())) {
  243. if (node2.getValue().equals(eventLoc.getBlockZ())) {
  244. player.sendMessage(Text.of(TextColors.GREEN, "The second electric lock opened! The motorized door opened!"));
  245. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission set second.gate true");
  246. } else {
  247. player.sendMessage(Text.of(TextColors.RED, "Hey! The electric locks were reset!"));
  248. cmdManager.process(Sponge.getServer().getConsole(), "lp user " + playername + " permission unset first.gate");
  249. Random newRandom = new Random();
  250. int vermilionGymRandom = newRandom.nextInt(15 - 1) + 1;
  251. if (vermilionGymRandom == 1) {
  252. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(1);
  253. accountManagerGyms.saveConfig();
  254. } else if (vermilionGymRandom == 2) {
  255. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(2);
  256. accountManagerGyms.saveConfig();
  257. } else if (vermilionGymRandom == 3) {
  258. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(3);
  259. accountManagerGyms.saveConfig();
  260. } else if (vermilionGymRandom == 4) {
  261. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(4);
  262. accountManagerGyms.saveConfig();
  263. } else if (vermilionGymRandom == 5) {
  264. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(5);
  265. accountManagerGyms.saveConfig();
  266. } else if (vermilionGymRandom == 6) {
  267. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(6);
  268. accountManagerGyms.saveConfig();
  269. } else if (vermilionGymRandom == 7) {
  270. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(7);
  271. accountManagerGyms.saveConfig();
  272. } else if (vermilionGymRandom == 8) {
  273. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(8);
  274. accountManagerGyms.saveConfig();
  275. } else if (vermilionGymRandom == 9) {
  276. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(9);
  277. accountManagerGyms.saveConfig();
  278. } else if (vermilionGymRandom == 10) {
  279. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(10);
  280. accountManagerGyms.saveConfig();
  281. } else if (vermilionGymRandom == 11) {
  282. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(11);
  283. accountManagerGyms.saveConfig();
  284. } else if (vermilionGymRandom == 12) {
  285. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(12);
  286. accountManagerGyms.saveConfig();
  287. } else if (vermilionGymRandom == 13) {
  288. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(13);
  289. accountManagerGyms.saveConfig();
  290. } else if (vermilionGymRandom == 14) {
  291. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(14);
  292. accountManagerGyms.saveConfig();
  293. } else if (vermilionGymRandom == 15) {
  294. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(15);
  295. accountManagerGyms.saveConfig();
  296. }
  297. }
  298. }
  299. } else {
  300. player.sendMessage(Text.of("You have the permission!"));
  301. }
  302. }
  303. }
  304. }
  305.  
  306. @Listener
  307. public void onWalkingonClay (MoveEntityEvent e, @Root Player player) {
  308. UUID uuid = player.getUniqueId();
  309. Location<World> loc1 = player.getLocation();
  310. Location<World> loc2 = loc1.sub(0, 1, 0);
  311. World world = Sponge.getServer().getWorlds().iterator().next();
  312. CommandManager cmdManager = Sponge.getCommandManager();
  313. String playername = player.getName();
  314.  
  315. if (e.getCause().first(Player.class).isPresent()) {
  316. if (loc2.getBlockType() == (BlockTypes.STAINED_HARDENED_CLAY)) {
  317. if (loc1.getBlockX() >= -1019 && loc1.getBlockX() <= -1006 && loc1.getBlockY() >= 68 && loc1.getBlockY() <= 70 && loc1.getBlockZ() >= -1790 && loc1.getBlockZ() <= -1786) {
  318. Vector3d r = player.getRotation();
  319. Location<World> tpTo = new Location<World>(world, -1015, 59, -1795);
  320. Transform tpToT = new Transform(tpTo).addRotation(r);
  321. e.setToTransform(tpToT);
  322. player.sendMessage(Text.of("Welcome to the Vermilion Gym!"));
  323. Random newRandom = new Random();
  324. int vermilionGymRandom = newRandom.nextInt(15 - 1) + 1;
  325. if (vermilionGymRandom == 1) {
  326. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(1);
  327. accountManagerGyms.saveConfig();
  328. } else if (vermilionGymRandom == 2) {
  329. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(2);
  330. accountManagerGyms.saveConfig();
  331. } else if (vermilionGymRandom == 3) {
  332. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(3);
  333. accountManagerGyms.saveConfig();
  334. } else if (vermilionGymRandom == 4) {
  335. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(4);
  336. accountManagerGyms.saveConfig();
  337. } else if (vermilionGymRandom == 5) {
  338. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(5);
  339. accountManagerGyms.saveConfig();
  340. } else if (vermilionGymRandom == 6) {
  341. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(6);
  342. accountManagerGyms.saveConfig();
  343. } else if (vermilionGymRandom == 7) {
  344. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(7);
  345. accountManagerGyms.saveConfig();
  346. } else if (vermilionGymRandom == 8) {
  347. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(8);
  348. accountManagerGyms.saveConfig();
  349. } else if (vermilionGymRandom == 9) {
  350. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(9);
  351. accountManagerGyms.saveConfig();
  352. } else if (vermilionGymRandom == 10) {
  353. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(10);
  354. accountManagerGyms.saveConfig();
  355. } else if (vermilionGymRandom == 11) {
  356. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(11);
  357. accountManagerGyms.saveConfig();
  358. } else if (vermilionGymRandom == 12) {
  359. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(12);
  360. accountManagerGyms.saveConfig();
  361. } else if (vermilionGymRandom == 13) {
  362. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(13);
  363. accountManagerGyms.saveConfig();
  364. } else if (vermilionGymRandom == 14) {
  365. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(14);
  366. accountManagerGyms.saveConfig();
  367. } else if (vermilionGymRandom == 15) {
  368. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans").setValue(15);
  369. accountManagerGyms.saveConfig();
  370. }
  371. ConfigurationNode node = accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "RNG for trash cans");
  372. if (node.getValue().equals(1)) {
  373. int xCoord = -1020;
  374. int zCoord = -1803;
  375. Random newCoords = new Random();
  376. int newCoord = newCoords.nextInt(2 - 1) + 1;
  377. if (newCoord == 1) {
  378. int newX = -1020 + 2;
  379. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  380. accountManagerGyms.saveConfig();
  381. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  382. accountManagerGyms.saveConfig();
  383. } else if (newCoord == 2) {
  384. int newZ = -1803 + 2;
  385. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1020);
  386. accountManagerGyms.saveConfig();
  387. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  388. accountManagerGyms.saveConfig();
  389. }
  390.  
  391. } else if (node.getValue().equals(2)) {
  392. int xCoord = -1018;
  393. int zCoord = -1803;
  394. Random newCoords = new Random();
  395. int newCoord = newCoords.nextInt(2 - 1) + 1;
  396. if (newCoord == 1) {
  397. int newX = -1018 + 2;
  398. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  399. accountManagerGyms.saveConfig();
  400. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  401. accountManagerGyms.saveConfig();
  402. } else if (newCoord == 2) {
  403. int newZ = -1803 + 2;
  404. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  405. accountManagerGyms.saveConfig();
  406. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  407. accountManagerGyms.saveConfig();
  408. }
  409. } else if (node.getValue().equals(3)) {
  410. int xCoord = -1016;
  411. int zCoord = -1803;
  412. Random newCoords = new Random();
  413. int newCoord = newCoords.nextInt(3 - 1) + 1;
  414. if (newCoord == 1) {
  415. int newX = -1016 + 2;
  416. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  417. accountManagerGyms.saveConfig();
  418. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  419. accountManagerGyms.saveConfig();
  420. } else if (newCoord == 2) {
  421. int newX = -1016 - 2;
  422. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  423. accountManagerGyms.saveConfig();
  424. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  425. accountManagerGyms.saveConfig();
  426. } else if (newCoord == 3) {
  427. int newZ = -1803 + 2;
  428. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  429. accountManagerGyms.saveConfig();
  430. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  431. accountManagerGyms.saveConfig();
  432. }
  433. } else if (node.getValue().equals(4)) {
  434. int xCoord = -1014;
  435. int zCoord = -1803;
  436. Random newCoords = new Random();
  437. int newCoord = newCoords.nextInt(2 - 1) + 1;
  438. if (newCoord == 1) {
  439. int newX = -1014 - 2;
  440. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1012);
  441. accountManagerGyms.saveConfig();
  442. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  443. accountManagerGyms.saveConfig();
  444. } else if (newCoord == 2) {
  445. int newZ = -1803 + 2;
  446. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  447. accountManagerGyms.saveConfig();
  448. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  449. accountManagerGyms.saveConfig();
  450. }
  451. } else if (node.getValue().equals(5)) {
  452. int xCoord = -1012;
  453. int zCoord = -1803;
  454. Random newCoords = new Random();
  455. int newCoord = newCoords.nextInt(2 - 1) + 1;
  456. if (newCoord == 1) {
  457. int newX = -1012 - 2;
  458. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  459. accountManagerGyms.saveConfig();
  460. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1803);
  461. accountManagerGyms.saveConfig();
  462. } else if (newCoord == 2) {
  463. int newZ = -1803 + 2;
  464. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1012);
  465. accountManagerGyms.saveConfig();
  466. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  467. accountManagerGyms.saveConfig();
  468. }
  469. } else if (node.getValue().equals(6)) {
  470. int xCoord = -1020;
  471. int zCoord = -1801;
  472. int newX = -1020 + 2;
  473. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  474. accountManagerGyms.saveConfig();
  475. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  476. accountManagerGyms.saveConfig();
  477. } else if (node.getValue().equals(7)) {
  478. int xCoord = -1018;
  479. int zCoord = -1801;
  480. int newX = -1018 + 2;
  481. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  482. accountManagerGyms.saveConfig();
  483. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  484. accountManagerGyms.saveConfig();
  485. } else if (node.getValue().equals(8)) {
  486. int xCoord = -1016;
  487. int zCoord = -1801;
  488. Random newCoords = new Random();
  489. int newCoord = newCoords.nextInt(2 - 1) + 1;
  490. if (newCoord == 1) {
  491. int newX = -1016 - 2;
  492. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  493. accountManagerGyms.saveConfig();
  494. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  495. accountManagerGyms.saveConfig();
  496. } else if (newCoord == 2) {
  497. int newX = -1016 + 2;
  498. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  499. accountManagerGyms.saveConfig();
  500. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  501. accountManagerGyms.saveConfig();
  502. }
  503. } else if (node.getValue().equals(9)) {
  504. int xCoord = -1014;
  505. int zCoord = -1801;
  506. int newX = -1014 - 2;
  507. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  508. accountManagerGyms.saveConfig();
  509. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  510. accountManagerGyms.saveConfig();
  511. } else if (node.getValue().equals(10)) {
  512. int xCoord = -1012;
  513. int zCoord = -1801;
  514. int newX = -1012 - 2;
  515. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  516. accountManagerGyms.saveConfig();
  517. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  518. accountManagerGyms.saveConfig();
  519. } else if (node.getValue().equals(11)) {
  520. int xCoord = -1020;
  521. int zCoord = -1799;
  522. Random newCoords = new Random();
  523. int newCoord = newCoords.nextInt(2 - 1) + 1;
  524. if (newCoord == 1) {
  525. int newX = -1020 + 2;
  526. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  527. accountManagerGyms.saveConfig();
  528. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  529. accountManagerGyms.saveConfig();
  530. } else {
  531. int newZ = -1799 - 2;
  532. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1020);
  533. accountManagerGyms.saveConfig();
  534. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  535. accountManagerGyms.saveConfig();
  536. }
  537. } else if (node.getValue().equals(12)) {
  538. int xCoord = -1018;
  539. int zCoord = -1799;
  540. Random newCoords = new Random();
  541. int newCoord = newCoords.nextInt(2 - 1) + 1;
  542. if (newCoord == 1) {
  543. int newX = -1018 + 2;
  544. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  545. accountManagerGyms.saveConfig();
  546. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  547. accountManagerGyms.saveConfig();
  548. } else {
  549. int newZ = -1799 - 2;
  550. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  551. accountManagerGyms.saveConfig();
  552. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  553. accountManagerGyms.saveConfig();
  554. }
  555. } else if (node.getValue().equals(13)) {
  556. int xCoord = -1016;
  557. int zCoord = -1799;
  558. Random newCoords = new Random();
  559. int newCoord = newCoords.nextInt(3 - 1) + 1;
  560. if (newCoord == 1) {
  561. int newX = -1016 + 2;
  562. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  563. accountManagerGyms.saveConfig();
  564. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  565. accountManagerGyms.saveConfig();
  566. } else if (newCoord == 2) {
  567. int newZ = -1799 - 2;
  568. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1016);
  569. accountManagerGyms.saveConfig();
  570. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  571. accountManagerGyms.saveConfig();
  572. } else if (newCoord == 3) {
  573. int newX = -1016 - 2;
  574. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1018);
  575. accountManagerGyms.saveConfig();
  576. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  577. accountManagerGyms.saveConfig();
  578. }
  579. } else if (node.getValue().equals(14)) {
  580. int xCoord = -1014;
  581. int zCoord = -1799;
  582. Random newCoords = new Random();
  583. int newCoord = newCoords.nextInt(2 - 1) + 1;
  584. if (newCoord == 1) {
  585. int newX = -1014 + 2;
  586. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1012);
  587. accountManagerGyms.saveConfig();
  588. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  589. accountManagerGyms.saveConfig();
  590. } else if (newCoord == 2) {
  591. int newZ = -1799 - 2;
  592. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1014);
  593. accountManagerGyms.saveConfig();
  594. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  595. accountManagerGyms.saveConfig();
  596. }
  597. } else if (node.getValue().equals(15)) {
  598. int xCoord = -1012;
  599. int zCoord = -1799;
  600. Random newCoords = new Random();
  601. int newCoord = newCoords.nextInt(2 - 1) + 1;
  602. if (newCoord == 1) {
  603. int newX = -1014 + 2;
  604. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1012);
  605. accountManagerGyms.saveConfig();
  606. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1799);
  607. accountManagerGyms.saveConfig();
  608. } else if (newCoord == 2) {
  609. int newZ = -1799 - 2;
  610. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "xCoord").setValue(-1012);
  611. accountManagerGyms.saveConfig();
  612. accountManagerGyms.getAccountsConfig().getNode(uuid.toString(), "Kanto Gyms", "Vermilion", "newCoords", "zCoord").setValue(-1801);
  613. accountManagerGyms.saveConfig();
  614. }
  615. }
  616.  
  617. } else if (loc1.getBlockX() >= -1019 && loc1.getBlockX() <= -1011 && loc1.getBlockY() >= 59 && loc1.getBlockY() <= 61 && loc1.getBlockZ() >= -1804 && loc1.getBlockZ() <= -1803) {
  618. if (player.hasPermission("first.gate") && player.hasPermission("second.gate")) {
  619. Vector3d r = player.getRotation();
  620. Location<World> tpTo = new Location<World>(world, -1015, 59, -1808);
  621. Transform tpToT = new Transform(tpTo).addRotation(r);
  622. e.setToTransform(tpToT);
  623. } else {
  624. player.sendMessage(Text.of(TextColors.RED, "You have not unlocked the gates!"));
  625. }
  626. } else if (loc1.getBlockX() >= -1016 && loc1.getBlockX() <= -1014 && loc1.getBlockY() >= 59 && loc1.getBlockY() <= 61 && loc1.getBlockZ() >= -1807 && loc1.getBlockZ() <= -1804) {
  627. Vector3d r = player.getRotation();
  628. Location<World> tpTo = new Location<World>(world, -1014, 59, -1802);
  629. Transform tpToT = new Transform(tpTo).addRotation(r);
  630. e.setToTransform(tpToT);
  631. }
  632. }
  633. }
  634. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement