|
|
|
@ -23,7 +23,8 @@ class BloodMoon : JavaPlugin(), Listener {
|
|
|
|
|
initListeners()
|
|
|
|
|
|
|
|
|
|
schedule(async = false, period = 1, delay = 1) {
|
|
|
|
|
if (Bukkit.getWorlds().first().fullTime - Config.startTime in 0..20) {
|
|
|
|
|
val time = Config.world.time
|
|
|
|
|
if (time - Config.startTime in 0..20) {
|
|
|
|
|
val chance = Random.nextDouble()
|
|
|
|
|
if (!BMData.running && chance < Config.chance) BMData.begin()
|
|
|
|
|
else Bukkit.getOnlinePlayers().filter { it.hasPermission("bloodmoon.admin") || it.isOp }.forEach {
|
|
|
|
@ -34,11 +35,16 @@ class BloodMoon : JavaPlugin(), Listener {
|
|
|
|
|
)} (must be between 0 and ${Config.chance}) "
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
} else if (((Config.endTime > Config.startTime && (time < Config.startTime || time > Config.endTime)) ||
|
|
|
|
|
(Config.endTime < Config.startTime && (Config.endTime < time && time < Config.startTime)))
|
|
|
|
|
&& BMData.running
|
|
|
|
|
) {
|
|
|
|
|
BMData.stop()
|
|
|
|
|
Bukkit.getOnlinePlayers().forEach { it.msg(Config.endMessage.c) }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command("bloodmoon") { sender, args ->
|
|
|
|
|
|
|
|
|
|
if (args.isEmpty())
|
|
|
|
|
return@command (if (BMData.running) sender.msg("&c&lThe Blood Moon is Active!\n&7${BMData.ticksLeft() / 20} seconds left.")
|
|
|
|
|
else sender.msg("&a&lThe Blood Moon is not currently active."))
|
|
|
|
@ -55,7 +61,7 @@ class BloodMoon : JavaPlugin(), Listener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"start" -> {
|
|
|
|
|
Config.world.time = 13050
|
|
|
|
|
Config.world.time = Config.startTime + 50L
|
|
|
|
|
sender.msg("&c[!] &7Blood moon has started manually.")
|
|
|
|
|
BMData.begin()
|
|
|
|
|
}
|
|
|
|
|