Skip to content

Commit

Permalink
Merge pull request #1170 from GiganticMinecraft/develop
Browse files Browse the repository at this point in the history
バージョン 15 リリース
  • Loading branch information
kory33 authored Sep 29, 2021
2 parents 4779400 + 962463e commit c8840b3
Show file tree
Hide file tree
Showing 59 changed files with 1,317 additions and 802 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/cache@v2
env:
cache-name: cache-build-dependencies
cache-version: v-2
cache-version: v-3
with:
# sbt等は$HOMEではなくユーザーディレクトリを見ているようで、
# GH Actionsでの ~ は /github/home/ に展開されるにもかかわらず
Expand All @@ -47,7 +47,7 @@ jobs:
uses: actions/cache@v2
env:
cache-name: cache-build
cache-version: v-2
cache-version: v-3
with:
path: |
target
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- [Intellij IDEA](https://www.jetbrains.com/idea/) などの統合開発環境
- [AdoptOpenJDK 1.8](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot)
- [Scala 2.13](https://www.scala-lang.org/download/)
- [sbt 1.3.7](https://www.scala-sbt.org/1.x/docs/Setup.html)
- [sbt 1.5.5](https://www.scala-sbt.org/1.x/docs/Setup.html)
- Spigot 1.12.2

## 前提プラグイン
Expand Down Expand Up @@ -87,7 +87,7 @@ masterブランチは本番環境に反映されます。

## AutoRelease
- developブランチが更新されると、そのコードを基に実行用jarがビルドされ、デバッグ環境に配布されます。デバッグ環境はjarの配布を検知すると自動で再起動し、最新のjarを使用して稼働します。
- デバッグ環境へは、Minecraft Java Editionで`play.seichi.click`に接続し、`T`キーでチャットを開き、`/server deb112`と入力して`Enter`を押すとアクセスできます。
- デバッグ環境へは、Minecraft Java Editionで`play-debug.seichi.click`に接続し、`T`キーでチャットを開き、`/server deb112`と入力して`Enter`を押すとアクセスできます。
- masterブランチが更新されると、そのコードを基に実行用jarがビルドされ、本番環境に配布されます。本番環境は翌再起動時に自動で最新のjarを取り込んで稼働します。
- jar以外の自動リリースは未対応です(config.ymlなど)。運営チームへ更新を依頼する必要があります。
- 各サーバーや環境で共通で構わないパラメータはconfig.ymlを読まず、コードへの直接実装を推奨します。
Expand Down
26 changes: 13 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.io._
ThisBuild / scalaVersion := "2.13.1"
// ThisBuild / version はGitHub Actionsによって自動更新される。
// 次の行は ThisBuild / version := "(\d*)" の形式でなければならない。
ThisBuild / version := "13"
ThisBuild / version := "15"
ThisBuild / organization := "click.seichi"
ThisBuild / description := "ギガンティック☆整地鯖の独自要素を司るプラグイン"

Expand Down Expand Up @@ -81,8 +81,8 @@ val dependenciesToEmbed = Seq(
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full)

// localDependenciesはprovidedとして扱い、jarに埋め込まない
assemblyExcludedJars in assembly := {
(fullClasspath in assembly).value
assembly / assemblyExcludedJars := {
(assembly / fullClasspath).value
.filter { a =>
def directoryContainsFile(directory: File, file: File) =
file.absolutePath.startsWith(directory.absolutePath)
Expand All @@ -102,33 +102,33 @@ val filesToBeReplacedInResourceFolder = Seq("plugin.yml")

val filteredResourceGenerator = taskKey[Seq[File]]("Resource generator to filter resources")

filteredResourceGenerator in Compile :=
Compile / filteredResourceGenerator :=
filterResources(
filesToBeReplacedInResourceFolder,
tokenReplacementMap.value,
(resourceManaged in Compile).value, (resourceDirectory in Compile).value
(Compile / resourceManaged).value, (Compile / resourceDirectory).value
)

resourceGenerators in Compile += (filteredResourceGenerator in Compile)
Compile / resourceGenerators += (Compile / filteredResourceGenerator)

unmanagedResources in Compile += baseDirectory.value / "LICENSE"
Compile / unmanagedResources += baseDirectory.value / "LICENSE"

// トークン置換を行ったファイルをunmanagedResourcesのコピーから除外する
excludeFilter in unmanagedResources :=
filesToBeReplacedInResourceFolder.foldLeft((excludeFilter in unmanagedResources).value)(_.||(_))
unmanagedResources / excludeFilter :=
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(_.||(_))

logLevel := Level.Debug

// ScalaPBの設定
PB.protoSources in Compile := Seq(baseDirectory.value / "protocol")
PB.targets in Compile := Seq(scalapb.gen() -> (sourceManaged in Compile).value / "scalapb")
Compile / PB.protoSources := Seq(baseDirectory.value / "protocol")
Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value / "scalapb")

testOptions in Test += Tests.Argument("-oS")
Compile / testOptions += Tests.Argument("-oS")

lazy val root = (project in file("."))
.settings(
name := "SeichiAssist",
assemblyOutputPath in assembly := baseDirectory.value / "target" / "build" / s"SeichiAssist.jar",
assembly / assemblyOutputPath := baseDirectory.value / "target" / "build" / s"SeichiAssist.jar",
libraryDependencies := providedDependencies ++ testDependencies ++ dependenciesToEmbed,
excludeDependencies := Seq(
ExclusionRule(organization = "org.bukkit", name = "bukkit")
Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ services:
volumes:
- spigot_a:/spigot/
ports:
- 25566:25565
- 7091:7091
- "25566:25565"
- "7091:7091"
environment:
- JMX_PORT=7091
- JMX_BINDING=0.0.0.0
Expand All @@ -47,8 +47,8 @@ services:
volumes:
- spigot_b:/spigot/
ports:
- 25567:25565
- 7092:7091
- "25567:25565"
- "7092:7091"
environment:
- JMX_PORT=7091
- JMX_BINDING=0.0.0.0
Expand All @@ -68,7 +68,7 @@ services:
context: .
dockerfile: ./docker/bungeecord/Dockerfile
ports:
- 25565:25577
- "25565:25577"
networks:
- seichi
environment:
Expand All @@ -84,7 +84,7 @@ services:
context: .
dockerfile: ./docker/bungeecord/Dockerfile
ports:
- 25564:25577
- "25564:25577"
networks:
- seichi
environment:
Expand All @@ -108,7 +108,7 @@ services:
networks:
- seichi
ports:
- 8080:80
- "8080:80"
depends_on:
- db
redis:
Expand All @@ -131,4 +131,4 @@ services:
volumes:
- db-data:/var/lib/mysql
ports:
- 3306:3306
- "3306:3306"
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.9
sbt.version=1.5.5
23 changes: 23 additions & 0 deletions src/main/resources/db/migration/V1.7.2__Widen_present_id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use seichiassist;

-- このマイグレーションが走る時点ではpresentシステムが正常に動作しておらず、
-- データが入っていないため問題なし
-- foreign key制約によってalter table出来なかったため作り直している
DROP TABLE present_state;
DROP TABLE present;

-- プレゼントIDと実体の対応付け
CREATE TABLE IF NOT EXISTS present(
present_id bigint PRIMARY KEY auto_increment,
itemstack blob NOT NULL
);

-- プレイヤーがプレゼントを受け取ったかどうかをモデリングする
CREATE TABLE IF NOT EXISTS present_state(
present_id bigint NOT NULL,
uuid char(36) NOT NULL,
claimed boolean NOT NULL,

PRIMARY KEY(present_id, uuid),
FOREIGN KEY present_id_in_present_state_must_exist_in_presents_table(present_id) REFERENCES present(present_id)
);
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ commands:
permission-message: *denied
present:
description: send a gift
usage: /<command> [player name]
usage: /present <操作> (詳細については/present helpを参照してください)
permission-message: *denied
hat:
description: set item in hand to head
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import org.bukkit.command.CommandSender
/**
* 実行されたときに[effect]を送り返すだけの[ContextualExecutor].
*/
class EchoExecutor(private val effect: TargetedEffect[CommandSender]) extends ContextualExecutor {
case class EchoExecutor(effect: TargetedEffect[CommandSender]) extends ContextualExecutor {
override def executeWith(rawContext: RawCommandContext): IO[Unit] = effect(rawContext.sender)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.unchama.contextualexecutor.executors

import cats.effect.IO
import com.github.unchama.contextualexecutor.{ContextualExecutor, RawCommandContext}

case class TraverseExecutor(executors: List[ContextualExecutor]) extends ContextualExecutor {
import cats.implicits._

override def executeWith(commandContext: RawCommandContext): IO[Unit] = {
executors.traverse(_.executeWith(commandContext)).void
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ object MaterialSets {
Material.WOODEN_DOOR, Material.ACACIA_DOOR, Material.BIRCH_DOOR, Material.DARK_OAK_DOOR,
Material.JUNGLE_DOOR, Material.SPRUCE_DOOR,
Material.SMOOTH_STAIRS, Material.BREWING_STAND, Material.WOOD_STEP, Material.TNT,
//#1027,#1159
Material.WOOD_STEP, Material.WOOD_DOUBLE_STEP,
Material.DISPENSER, Material.PISTON_STICKY_BASE, Material.STRING
) ++ fortuneMaterials

// これらのマテリアルを持つブロックは破壊を整地量に計上しない
Expand Down
32 changes: 22 additions & 10 deletions src/main/scala/com/github/unchama/seichiassist/SeichiAssist.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import com.github.unchama.seichiassist.subsystems.mana.{ManaApi, ManaReadApi}
import com.github.unchama.seichiassist.subsystems.managedfly.ManagedFlyApi
import com.github.unchama.seichiassist.subsystems.present.infrastructure.GlobalPlayerAccessor
import com.github.unchama.seichiassist.subsystems.seasonalevents.api.SeasonalEventsAPI
import com.github.unchama.seichiassist.subsystems.subhome.SubHomeReadAPI
import com.github.unchama.seichiassist.task.PlayerDataSaveTask
import com.github.unchama.seichiassist.task.global._
import com.github.unchama.util.{ActionStatus, ClassUtils}
Expand Down Expand Up @@ -302,6 +303,23 @@ class SeichiAssist extends JavaPlugin() {
subsystems.discordnotification.System.wired[IO](seichiAssistConfig.discordNotificationConfiguration)
}

lazy val subhomeSystem: subhome.System[IO] = {
import PluginExecutionContexts.asyncShift

implicit val effectEnvironment: EffectEnvironment = DefaultEffectEnvironment
implicit val concurrentEffect: ConcurrentEffect[IO] = IO.ioConcurrentEffect(asyncShift)
subhome.System.wired
}

lazy val presentSystem: Subsystem[IO] = {
import PluginExecutionContexts.{asyncShift, onMainThread}

implicit val effectEnvironment: EffectEnvironment = DefaultEffectEnvironment
implicit val concurrentEffect: ConcurrentEffect[IO] = IO.ioConcurrentEffect(asyncShift)
implicit val uuidToLastSeenName: UuidToLastSeenName[IO] = new GlobalPlayerAccessor[IO]
subsystems.present.System.wired
}

private lazy val wiredSubsystems: List[Subsystem[IO]] = List(
mebiusSystem,
expBottleStackSystem,
Expand All @@ -319,6 +337,8 @@ class SeichiAssist extends JavaPlugin() {
fourDimensionalPocketSystem,
gachaPointSystem,
discordNotificationSystem,
subhomeSystem,
presentSystem
)

private lazy val buildAssist: BuildAssist = {
Expand Down Expand Up @@ -360,15 +380,6 @@ class SeichiAssist extends JavaPlugin() {
)
}

lazy val presentSystem: Subsystem[IO] = {
import PluginExecutionContexts.{asyncShift, onMainThread}

implicit val effectEnvironment: EffectEnvironment = DefaultEffectEnvironment
implicit val concurrentEffect: ConcurrentEffect[IO] = IO.ioConcurrentEffect(asyncShift)
implicit val uuidToLastSeenName: UuidToLastSeenName[IO] = new GlobalPlayerAccessor[IO]
subsystems.present.System.wired
}

//endregion

private implicit val _akkaSystem: ActorSystem = ConfiguredActorSystemProvider("reference.conf").provide()
Expand Down Expand Up @@ -470,6 +481,8 @@ class SeichiAssist extends JavaPlugin() {
implicit val gachaPointApi: GachaPointApi[IO, SyncIO, Player] = gachaPointSystem.api
implicit val manaApi: ManaApi[IO, SyncIO, Player] = manaSystem.manaApi
implicit val globalNotification: DiscordNotificationAPI[IO] = discordNotificationSystem.globalNotification
implicit val subHomeReadApi: SubHomeReadAPI[IO] = subhomeSystem.api

val menuRouter = TopLevelRouter.apply
import menuRouter.canOpenStickMenu

Expand Down Expand Up @@ -505,7 +518,6 @@ class SeichiAssist extends JavaPlugin() {
"rmp" -> RmpCommand.executor,
"shareinv" -> ShareInvCommand.executor,
"halfguard" -> HalfBlockProtectCommand.executor,
"subhome" -> SubHomeCommand.executor,
"gtfever" -> GiganticFeverCommand.executor,
"minehead" -> new MineHeadCommand().executor,
"x-transfer" -> RegionOwnerTransferCommand.executor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,18 @@ object NicknameMapping {
case No_9033 => NicknameCombination(Some(9033), Some(9903), Some(9033))
case No_9034 => NicknameCombination(Some(9034), None, Some(9034))
case No_9035 => NicknameCombination(Some(9035), Some(9905), Some(9035))
case No_9036 => NicknameCombination(Some(9036), None, Some(9036))
case No_9036 => NicknameCombination(Some(9036), Some(9903), Some(9036))
case No_9037 => NicknameCombination(Some(9037), None, Some(9037))
case No_9038 => NicknameCombination(Some(9038), None, Some(9038))
case No_9039 => NicknameCombination(Some(9039), None, Some(9039))
case No_9040 => NicknameCombination(Some(9040), None, Some(9040))
case No_9041 => NicknameCombination(Some(9041), None, Some(9041))
case No_9042 => NicknameCombination(Some(9042), Some(9905), Some(9042))
case No_9043 => NicknameCombination(Some(9043), None, Some(9043))
case No_9044 => NicknameCombination(Some(9044), Some(9044), Some(9044))
case No_9045 => NicknameCombination(Some(9045), None, Some(9045))
case No_9046 => NicknameCombination(Some(9046), None, None)
case No_9047 => NicknameCombination(Some(9047), None, Some(9047))

case No_8001 => NicknameCombination(Some(8001), Some(9905), Some(8001))
case No_8002 => NicknameCombination(Some(8002), Some(9905), Some(8002))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,18 @@ object Nicknames {
9033 -> HeadTail(s"団子", s"団子"),
9034 -> HeadTail(s"全額", s"投資"),
9035 -> HeadTail(s"無尽蔵", s"気力"),
9036 -> HeadTail(s"猛毒", s"直撃"),
9036 -> HeadTail(s"", s"一緒に"),
9037 -> HeadTail(s"", s"うさぎ"),
9038 -> HeadTail(s"美しい", s"装い"),
9039 -> HeadTail(s"猛毒", s"直撃"),
9040 -> HeadTail(s"", s"替え"),
9041 -> HeadTail(s"体力", s"勝負"),
9042 -> HeadTail(s"トパーズ", s"輝き"),
9043 -> HeadTail(s"千歳", s""),
9044 -> FullSet(s"いい", s"肉の", s""),
9045 -> HeadTail(s"", s"掃除"),
9046 -> HeadOnly(s"歳暮"),
9047 -> HeadTail(s"聖なる", s""),
// 前後パーツ(購入用)
9801 -> HeadTail(s"お兄さん", s"お兄さん"),
9802 -> HeadTail(s"戦隊", s"戦隊"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package com.github.unchama.seichiassist.achievement

import java.time.{DayOfWeek, Month}

import cats.effect.IO
import com.github.unchama.seichiassist.achievement.NamedHoliday.SpringEquinoxDay
import enumeratum.{Enum, EnumEntry}
import org.bukkit.entity.Player

import java.time.{DayOfWeek, Month}

sealed abstract class SeichiAchievement extends EnumEntry {
val id: Int
}

object SeichiAchievement extends Enum[SeichiAchievement] {

sealed trait Unlockable

sealed trait AutoUnlocked

sealed trait ManuallyUnlocked

sealed abstract class Normal[P] extends SeichiAchievement with Unlockable {
Expand Down Expand Up @@ -234,7 +237,18 @@ object SeichiAchievement extends Enum[SeichiAchievement] {
case object No_9033 extends NormalManual(9033, playedIn(Month.SEPTEMBER))
case object No_9034 extends NormalManual(9034, playedOn(Month.SEPTEMBER, 2, "とあるくじの日"))
case object No_9035 extends NormalManual(9035, playedOn(Month.SEPTEMBER, 12, "とあるマラソンの日"))
case object No_9036 extends NormalManual(9036, playedOn(Month.SEPTEMBER, 29, "とあるふぐの日"))
case object No_9036 extends NormalManual(9036, playedOn(Month.SEPTEMBER, 15, "とある月見の日"))
case object No_9037 extends NormalManual(9037, playedOn(Month.SEPTEMBER, 21, "とある中秋の日"))
case object No_9038 extends NormalManual(9038, playedOn(Month.SEPTEMBER, 21, "とあるファッションショーの日"))
case object No_9039 extends NormalManual(9039, playedOn(Month.SEPTEMBER, 29, "とあるふぐの日"))
case object No_9040 extends NormalManual(9040, playedIn(Month.OCTOBER))
case object No_9041 extends NormalManual(9041, playedOn(Month.OCTOBER, 10, "とあるスポーツの日"))
case object No_9042 extends NormalManual(9042, playedIn(Month.NOVEMBER))
case object No_9043 extends NormalManual(9043, playedOn(Month.NOVEMBER, 15, "とある七五三の日"))
case object No_9044 extends NormalManual(9044, playedOn(Month.NOVEMBER, 29, "とある特上の肉の日"))
case object No_9045 extends NormalManual(9045, playedIn(Month.DECEMBER))
case object No_9046 extends NormalManual(9046, playedOn(Month.DECEMBER, 1, "とある年の暮れの日"))
case object No_9047 extends NormalManual(9047, playedOn(Month.DECEMBER, 25, "とあるクリスマスの日"))

val values: IndexedSeq[SeichiAchievement] = findValues

Expand Down
Loading

0 comments on commit c8840b3

Please sign in to comment.