Skip to content

Commit

Permalink
Merge pull request #1913 from GiganticMinecraft/fix/DoNotCreateVoteData
Browse files Browse the repository at this point in the history
初参加プレイヤーの投票データが作成されない不具合を修正
  • Loading branch information
Lucky3028 authored Feb 26, 2023
2 parents a56ec23 + e796b7b commit c707dcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package com.github.unchama.seichiassist.subsystems.vote.bukkit.listeners
import cats.effect.ConcurrentEffect
import cats.effect.ConcurrentEffect.ops.toAllConcurrentEffectOps
import com.github.unchama.seichiassist.subsystems.vote.domain.VotePersistence
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.event.{EventHandler, Listener}
import org.bukkit.event.player.AsyncPlayerPreLoginEvent
import org.bukkit.event.{EventHandler, EventPriority, Listener}

class PlayerDataCreator[F[_]: ConcurrentEffect](implicit votePersistence: VotePersistence[F])
extends Listener {

@EventHandler
def onJoin(e: PlayerJoinEvent): Unit = {
votePersistence.createPlayerData(e.getPlayer.getUniqueId).toIO.unsafeRunSync()
@EventHandler(priority = EventPriority.HIGHEST)
def onPlayerPreLoginEvent(e: AsyncPlayerPreLoginEvent): Unit = {
votePersistence.createPlayerData(e.getUniqueId).toIO.unsafeRunAsyncAndForget()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class JdbcVotePersistence[F[_]: Sync] extends VotePersistence[F] {
// NOTE: 連続投票日数許容幅を変更する場合はここを変更してください。
private val consecutiveVoteStreakDaysThreshold = 1

def createPlayerData(uuid: UUID): F[Unit] = Sync[F].delay {
override def createPlayerData(uuid: UUID): F[Unit] = Sync[F].delay {
DB.localTx { implicit session =>
sql"""INSERT IGNORE INTO vote
| (uuid, vote_number, chain_vote_number, effect_point, given_effect_point, last_vote)
Expand Down

0 comments on commit c707dcc

Please sign in to comment.