Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. if (args[0].equals("force", true)) {
  2. if (sender.hasPermission("koth.force")) {
  3. println("s1")
  4. if (!this.instance.isEvent) {
  5. println("s2")
  6. val node: ConfigurationSection = instance.config.getConfigurationSection("locations")
  7. var x: Int = 0
  8. var y: Int = 0
  9. var z: Int = 0
  10. val timeList: List<String> = instance.config.getStringList("launchTime")
  11. if (timeList.isNotEmpty()) {
  12. println("s3")
  13. val hour: SimpleDateFormat = SimpleDateFormat("HH:mm")
  14. val date: Date = Date()
  15. timeList.forEach {
  16. println("s4")
  17. val split = it.split("#")
  18.  
  19. if (node.getConfigurationSection(split[0].toLowerCase()) == null) {
  20. println("s02020")
  21. x = node.getInt("default.x")
  22. y = node.getInt("default.y")
  23. z = node.getInt("default.z")
  24. } else {
  25. if (split[0].toLowerCase() == LocalDate.now().dayOfWeek.toString().toLowerCase()) {
  26. println("s5")
  27. val random: ThreadLocalRandom = ThreadLocalRandom.current()
  28. val day: ConfigurationSection = node.getConfigurationSection(split[0].toLowerCase())
  29. val max: Int = day.getInt("cordAmount")
  30. val randCords = random.nextInt(0, max)+1
  31. x = day.getInt("$randCords.x")
  32. y = day.getInt("$randCords.y")
  33. z = day.getInt("$randCords.z")
  34. }
  35. }
  36. }
  37.  
  38. forcedMessage.forEach { fc -> sender.sendMessage(ChatColor.translateAlternateColorCodes('&', fc.replace("[", "").replace("]", ""))) }
  39. this.instance.isEvent = true
  40. forceMessage.forEach { fc -> Bukkit.broadcastMessage(StringUtils.replaceEach(ChatColor.translateAlternateColorCodes('&', fc.replace("[", "").replace("]", "")),
  41. arrayOf("%x%", "%y%", "%z%"), arrayOf(x.toString(), y.toString(), z.toString()))) }
  42. this.instance.cords = arrayOf(x, y, z)
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement