Skip to content

Commit

Permalink
feat: run the task in each minute
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky3028 committed Sep 3, 2022
1 parent e068d16 commit 90942ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/scala/click/seichi/timetogo/presenter/TimeToGo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ package click.seichi.timetogo.presenter

import click.seichi.timetogo.infra.ModeTimeRepositoryImpl
import click.seichi.timetogo.model.ModeTimeRepository
import click.seichi.timetogo.presenter.listener.PlayerLoginListener
import click.seichi.timetogo.presenter.task.SetPlayerGameMode
import click.seichi.timetogo.usecase.ModeTimeUseCase
import click.seichi.timetogo.usecase.`trait`.Clock
import org.bukkit.Bukkit
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.scheduler.BukkitTask

import java.time.LocalTime

class TimeToGo extends JavaPlugin {
private var task: BukkitTask = _

TimeToGo.instance = this

override def onEnable(): Unit = {
Bukkit.getPluginManager.registerEvents(PlayerLoginListener, this)

this.task = SetPlayerGameMode.runTaskTimer(this, 0L, 20 * 60L)

Bukkit.getServer.getLogger.info("TimeToGo is Enabled!")
}

override def onDisable(): Unit = {
this.task.cancel()

Bukkit.getServer.getLogger.info("TimeToGo is Disabled!")
}
}

object TimeToGo {
Expand Down

0 comments on commit 90942ba

Please sign in to comment.