-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1374 from GiganticMinecraft/develop
バージョン 32 リリース
- Loading branch information
Showing
21 changed files
with
340 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/resources/db/migration/V1.7.5__Create_player_rate_limit_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE IF NOT EXISTS build_count_rate_limit( | ||
uuid CHAR(36) PRIMARY KEY NOT NULL, | ||
-- 注: DECIMALは(全体の桁数, 小数点以下の桁数)というフォーマットである | ||
available_permission DECIMAL(17, 5) UNSIGNED NOT NULL, | ||
updated_date DATETIME NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/scala/com/github/unchama/seichiassist/commands/VoteCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.github.unchama.seichiassist.commands | ||
|
||
import cats.data.Kleisli | ||
import cats.effect.IO | ||
import com.github.unchama.contextualexecutor.builder.Parsers | ||
import com.github.unchama.seichiassist.SeichiAssist | ||
import com.github.unchama.seichiassist.commands.contextual.builder.BuilderTemplates.playerCommandBuilder | ||
import com.github.unchama.seichiassist.util.Util | ||
import com.github.unchama.targetedeffect.{TargetedEffect, UnfocusedEffect} | ||
import com.github.unchama.targetedeffect.commandsender.MessageEffect | ||
import org.bukkit.ChatColor.{GREEN, RED, YELLOW} | ||
import org.bukkit.command.{CommandSender, TabExecutor} | ||
|
||
object VoteCommand { | ||
sealed trait Operation | ||
case object Record extends Operation | ||
|
||
val usageEchoEcexutor: TargetedEffect[CommandSender] = MessageEffect(List( | ||
s"$RED/vote record <プレイヤー名>", | ||
"投票特典配布用コマンドです" | ||
)) | ||
val executor: TabExecutor = playerCommandBuilder | ||
.argumentsParsers( | ||
List( | ||
Parsers.fromOptionParser({ | ||
case "record" => Some(Record) | ||
case _ => None | ||
}, usageEchoEcexutor), | ||
Parsers.identity | ||
) | ||
) | ||
.execution(context => { | ||
val args = context.args.parsed | ||
val command: Operation = args.head.asInstanceOf | ||
val name: String = args(1).asInstanceOf | ||
command match { | ||
case Record => { | ||
//引数が2つの時の処理 | ||
val lowerCasePlayerName = Util.getName(name) | ||
//プレイヤーオンライン、オフラインにかかわらずsqlに送信(マルチ鯖におけるコンフリクト防止の為) | ||
IO { | ||
for { | ||
_ <- MessageEffect(s"$YELLOW${lowerCasePlayerName}の投票特典配布処理開始…") | ||
_ <- UnfocusedEffect { | ||
SeichiAssist.databaseGateway.playerDataManipulator.incrementVotePoint(lowerCasePlayerName) | ||
} | ||
k = if (SeichiAssist.databaseGateway.playerDataManipulator.addChainVote(lowerCasePlayerName)) { | ||
MessageEffect(s"${GREEN}連続投票数の記録に成功") | ||
} else { | ||
MessageEffect(s"${RED}連続投票数の記録に失敗") | ||
} | ||
} yield k | ||
} | ||
} | ||
} | ||
}) | ||
.build() | ||
.asNonBlockingTabExecutor() | ||
} |
48 changes: 0 additions & 48 deletions
48
src/main/scala/com/github/unchama/seichiassist/commands/legacy/VoteCommand.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.