Skip to content

Commit

Permalink
Merge pull request #1923 from GiganticMinecraft/removeReImplementsPla…
Browse files Browse the repository at this point in the history
…yerDataParameters

再実装されてDBに存在しないパラメータを取得しようとしていたコードを削除
  • Loading branch information
Lucky3028 authored Mar 1, 2023
2 parents 72d0228 + 9a4d049 commit a5ceb1d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.github.unchama.seichiassist.subsystems.ranking.domain.{
Ranking,
RankingRecordWithPosition
}
import com.github.unchama.seichiassist.subsystems.vote.VoteAPI
import com.github.unchama.seichiassist.util.TypeConverter
import org.bukkit.Bukkit
import org.bukkit.ChatColor._
Expand All @@ -25,7 +26,8 @@ class PlayerStatsLoreGenerator(
playerData: PlayerData,
seichiRanking: Ranking[SeichiAmountData],
seichiAmountData: SeichiAmountData,
expBarVisibility: BreakCountBarVisibility
expBarVisibility: BreakCountBarVisibility,
voteAPI: VoteAPI[IO, Player]
) {
private val targetPlayer: Player = Bukkit.getPlayer(playerData.uuid)

Expand Down Expand Up @@ -167,11 +169,15 @@ class PlayerStatsLoreGenerator(
/**
* 連続投票日数の説明文.
*/
private def totalChainVoteDaysDescription(): List[String] =
if (playerData.ChainVote > 0)
List(s"$RESET${GRAY}連続投票日数:${playerData.ChainVote}")
private def totalChainVoteDaysDescription(): List[String] = {
val consecutiveVoteStreakDays =
voteAPI.currentConsecutiveVoteStreakDays(targetPlayer.getUniqueId).unsafeRunSync().value

if (consecutiveVoteStreakDays > 0)
List(s"$RESET${GRAY}連続投票日数:${consecutiveVoteStreakDays}")
else
Nil
}

/**
* Expバーの説明文.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,12 @@ class PlayerData(@Deprecated() val uuid: UUID, val name: String) {
var playTick = 0L
// 合計経験値
var totalexp = 0L
// 特典受け取り済み投票数
var p_givenvote = 0
// 連続・通算ログイン用
// ロード時に初期化される
var lastcheckdate: String = _
var loginStatus: LoginStatus = LoginStatus(null)
// 期間限定ログイン用
var LimitedLoginCount = 0
var ChainVote = 0

// region スキル関連のデータ
val skillState: Ref[IO, PlayerSkillState] = Ref.unsafe(PlayerSkillState.initial)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.github.unchama.seichiassist.subsystems.gachapoint.GachaPointApi
import com.github.unchama.seichiassist.subsystems.ranking.api.RankingProvider
import com.github.unchama.seichiassist.task.CoolDownTask
import com.github.unchama.seichiassist.ManagedWorld._
import com.github.unchama.seichiassist.subsystems.vote.VoteAPI
import com.github.unchama.seichiassist.{SeichiAssist, SkullOwners, util}
import com.github.unchama.targetedeffect.TargetedEffect.emptyEffect
import com.github.unchama.targetedeffect.commandsender.MessageEffect
Expand Down Expand Up @@ -92,7 +93,8 @@ object FirstPage extends Menu {
val ioCanOpenRankingRootMenu: IO CanOpen RankingRootMenu.type,
val ioCanOpenVoteMenu: IO CanOpen VoteMenu.type,
val enderChestAccessApi: AnywhereEnderChestAPI[IO],
val gachaTicketAPI: GachaTicketAPI[IO]
val gachaTicketAPI: GachaTicketAPI[IO],
val voteAPI: VoteAPI[IO, Player]
)

override val frame: MenuFrame =
Expand Down Expand Up @@ -175,8 +177,13 @@ object FirstPage extends Menu {
environment.breakCountAPI.seichiAmountDataRepository(player).read.toIO
ranking <- environment.rankingApi.ranking.read
visibility <- visibilityRef.get.toIO
lore <- new PlayerStatsLoreGenerator(openerData, ranking, seichiAmountData, visibility)
.computeLore()
lore <- new PlayerStatsLoreGenerator(
openerData,
ranking,
seichiAmountData,
visibility,
environment.voteAPI
).computeLore()
} yield Button(
new SkullItemStackBuilder(getUniqueId)
.title(s"$YELLOW$BOLD$UNDERLINE${getName}の統計データ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ object PlayerDataLoading {
playerData.unclaimedApologyItems = rs.getInt("numofsorryforbug")
playerData.regionCount = rs.getInt("rgnum")
playerData.playTick = rs.getLong("playtick")
playerData.p_givenvote = rs.getInt("p_givenvote")

playerData.totalexp = rs.getInt("totalexp")

Expand Down Expand Up @@ -252,8 +251,6 @@ object PlayerDataLoading {

playerData.lastcheckdate = sdf.format(cal.getTime)

playerData.ChainVote = rs.getInt("chainvote")

// 実績解除フラグのBitSet型への復元処理
// 初回nullエラー回避のための分岐
try {
Expand Down

0 comments on commit a5ceb1d

Please sign in to comment.