Skip to content

Commit

Permalink
Merge pull request #1971 from GiganticMinecraft/develop
Browse files Browse the repository at this point in the history
バージョン 77 リリース
  • Loading branch information
rito528 authored May 10, 2023
2 parents e992693 + b975963 commit 02bbd8a
Show file tree
Hide file tree
Showing 110 changed files with 3,412 additions and 1,601 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ project

target*
!target/build
localDependencies/ajd4jp-8.0.2.2021.jar
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.idea/
*.iml

# VSCode
.vscode

# SBT
/project/target
/project/project
Expand All @@ -15,4 +18,10 @@ localDependencies/spigot-1.12.2.jar
# Docker
docker/spigot/serverfiles/eula.txt

.env
.env

# Metal
.bloop
.metals
project/.bloop/
project/metals.sbt
2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ $ docker compose up --build -d
最初に、[GiganticMinecraftのページ][gm-gh-repo]を開いて、画面右上にある「fork」と書かれた枝分かれしているアイコンがあるボタンを押します。

すると「Create a new fork」と書かれた画面に移動します。
![img.png](img.png)

<!-- GitHub の issue とかに貼れば写真が GitHub の CDN 等に置かれるのでそのリンクを使う -->
![img.png](https://user-images.githubusercontent.com/127779256/226674317-3ad07000-a272-4f2e-905a-15e07b394bae.png)

いくつか入力欄がありますが、何も触らずにCreate forkを押します。

また画面が切り替わります。画面左上に書かれた文字が「GiganticMinecraft/SeichiAssist」ではなく、「(あなたのID)/SeichiAssist」になっていることを確認できたら次へ進みます。
Expand Down Expand Up @@ -163,11 +166,24 @@ DockerマシンのIPアドレス(Linux等なら`localhost`)を`DOCKER_IP`とし
`docker`により各サービスが起動したら、マルチプレイヤーのメニューで`DOCKER_IP`へと接続することができます。
また、`DOCKER_IP:8080`へとWebブラウザでアクセスすることで、phpMyAdminを介してデータベースを操作することができます。

`/op`などのコマンドを実行するためにSpigotのコンソールにアクセスする必要がある場合、
`spigota`または`spigotb`へのコンテナ名とともに `docker attach [CONTAINER_NAME]` を実行してください。
コンテナ名は `docker ps` を実行すると `seichiassist_spigotb_1` のような形式で表示されます。
##### コンソールにアクセスする

自分のアカウントに管理者権限(OP)を与える時など、Spigotのコンソールにアクセスする場合は、
`spigota` または `spigotb` のコンテナにアタッチする必要があります。

アタッチするには `docker attach [CONTAINER_NAME]` を実行します。
コンテナを指定する際に使用するIDはコマンドプロンプトで `docker ps` を実行すると `seichiassist_spigotb_1` のような形式で表示されます。

コンソールからは <kbd>Ctrl</kbd>キーと<kbd>C</kbd>キーを同時押しすることで出ることができます。サーバーは停止されません。

##### 整地ワールドの作成

初めてデバッグ環境のSpigotに接続した際にスポーンするワールドは整地ワールドではないため、そのままブロックを破壊しても整地レベルは上昇しません。

整地ワールドを作成する場合、OP権限を付与したプレイヤーかアタッチしたコンソールからコマンドで `mvcreate world_SW normal` を実行します。

整地ワールドへ行くには、コマンドで `mvtp world_SW` を実行します。

### 反映する
さあ、いよいよ反映の時間がやってきました。
まずは手元で`sbt scalafixAll`をします。次に`sbt scalafmtAll`をします。
Expand Down
31 changes: 26 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.io._
ThisBuild / scalaVersion := "2.13.4"
// ThisBuild / version はGitHub Actionsによって取得/自動更新される。
// 次の行は ThisBuild / version := "(\d*)" の形式でなければならない。
ThisBuild / version := "76"
ThisBuild / version := "77"
ThisBuild / organization := "click.seichi"
ThisBuild / description := "ギガンティック☆整地鯖の独自要素を司るプラグイン"

Expand Down Expand Up @@ -50,7 +50,9 @@ resolvers ++= Seq(
"oss.sonatype.org" at "https://oss.sonatype.org/content/repositories/snapshots",
"nexus.okkero.com" at "https://nexus.okkero.com/repository/maven-releases/",
"maven.elmakers.com" at "https://maven.elmakers.com/repository/", // spigot-api 1.12.2がhub.spigotmc.orgからダウンロードできなくなったため
"repo.phoenix616.dev" at "https://repo.phoenix616.dev" // authlibのための
"repo.phoenix616.dev" at "https://repo.phoenix616.dev", // authlibのための
// ajd4jpのミラーのため
"jitpack.io" at "https://jitpack.io"
)

val providedDependencies = Seq(
Expand Down Expand Up @@ -79,6 +81,7 @@ val dependenciesToEmbed = Seq(
"org.scala-lang.modules" %% "scala-collection-contrib" % "0.2.1",

// DB
"org.mariadb.jdbc" % "mariadb-java-client" % "3.1.4",
"org.flywaydb" % "flyway-core" % "5.2.4",
"org.scalikejdbc" %% "scalikejdbc" % "3.5.0",

Expand Down Expand Up @@ -111,6 +114,12 @@ val dependenciesToEmbed = Seq(
"io.circe" %% "circe-core" % "0.14.1",
"io.circe" %% "circe-generic" % "0.14.1",
"io.circe" %% "circe-parser" % "0.14.1",

// ajd4jp
"com.github.KisaragiEffective" % "ajd4jp-mirror" % "8.0.2.2021",

// Sentry
"io.sentry" % "sentry" % "6.18.1"
)

// endregion
Expand All @@ -127,6 +136,17 @@ assembly / assemblyExcludedJars := {
}
}

// protocol配下とルートのLICENSEが衝突してCIが落ちる
// cf. https://github.com/sbt/sbt-assembly/issues/141
assembly / assemblyMergeStrategy := {
case PathList(ps @ _*) if ps.last endsWith "LICENSE" => MergeStrategy.rename
case PathList("org", "apache", "commons", "logging", xs @ _*) =>
MergeStrategy.last
case otherFile =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(otherFile)
}

// endregion

// region プラグインJarに埋め込むリソースの処理
Expand All @@ -150,8 +170,6 @@ Compile / filteredResourceGenerator :=

Compile / resourceGenerators += (Compile / filteredResourceGenerator)

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

// トークン置換を行ったファイルをunmanagedResourcesのコピーから除外する
unmanagedResources / excludeFilter :=
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(
Expand Down Expand Up @@ -186,7 +204,10 @@ lazy val root = (project in file(".")).settings(
"-Ymacro-annotations",
"-Ywarn-unused"
),
javacOptions ++= Seq("-encoding", "utf8")
javacOptions ++= Seq("-encoding", "utf8"),
assembly / assemblyShadeRules ++= Seq(
ShadeRule.rename("org.mariadb.jdbc.**" -> "com.github.unchama.seichiassist.relocateddependencies.org.mariadb.jdbc.@1").inAll
)
)

// endregion
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ services:
- "25565:25577"
volumes:
- ./docker/bungeecord/serverfiles:/config
- ./docker/bungeecord/serverfiles/redisbungee/config.yml:/plugins/RedisBungee/config.yml
networks:
- seichi
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- SERVER_ID=bungeecord_1
- PLUGINS=https://github.com/ProxioDev/RedisBungee/releases/download/0.10.1/RedisBungee-Bungee-0.10.1-SNAPSHOT.jar
depends_on:
- spigota
- spigotb
Expand Down
77 changes: 77 additions & 0 deletions docker/bungeecord/serverfiles/redisbungee/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# RedisBungee configuration file.

# Cluster Mode
# enabling this option will enable cluster mode.
cluster-mode-enabled: false

# FORMAT:
# redis-cluster-servers:
# - host: 127.0.0.1
# port: 2020
# - host: 127.0.0.1
# port: 2021
# - host: 127.0.0.1
# port: 2021

# you can set single server and Jedis will automatically discover cluster nodes,
# but might fail if this single redis node is down when Proxy startup, its recommended put the all the nodes
redis-cluster-servers:
- host: 127.0.0.1
port: 6379

# Get Redis from http://redis.io/
# The Redis server you use.
# these settings are ignored when cluster mode is enabled.
redis-server: redis
redis-port: 6379

# OPTIONAL but recommended: If your Redis server uses AUTH, set the password required.
redis-password: ""
# Maximum connections that will be maintained to the Redis server.
# The default is 10. This setting should be left as-is unless you have some wildly
# inefficient plugins or a lot of players.
max-redis-connections: 10

# since redis can support ssl by version 6 you can use ssl / tls in redis bungee too!
# but there is more configuration needed to work see https://github.com/ProxioDev/RedisBungee/issues/18
# Keep note that SSL/TLS connections will decrease redis performance so use it when needed.
useSSL: false

# An identifier for this BungeeCord / Velocity instance. Will randomly generate if leaving it blank.
proxy-id: ""

# since version 0.8.0 Internally now uses JedisPooled instead of Jedis, JedisPool.
# which will break compatibility with old plugins that uses RedisBungee JedisPool
# so to mitigate this issue, we will instruct RedisBungee to init an JedisPool for compatibility reasons.
# enabled by default
# ignored when cluster mode is enabled
enable-jedis-pool-compatibility: true
# max connections for the compatibility pool
compatibility-max-connections: 3

# Register redis bungee legacy commands
# if this disabled override-bungee-commands will be ignored
register-legacy-commands: false

# Whether or not RedisBungee should install its version of regular BungeeCord commands.
# Often, the RedisBungee commands are desired, but in some cases someone may wish to
# override the commands using another plugin.
#
# If you are just denying access to the commands, RedisBungee uses the default BungeeCord
# permissions - just deny them and access will be denied.
#
# Please note that with build 787+, most commands overridden by RedisBungee were moved to
# modules, and these must be disabled or overridden yourself.
override-bungee-commands: false

# A list of IP addresses for which RedisBungee will not modify the response for, useful for automatic
# restart scripts.
exempt-ip-addresses: []

# restore old login when online behavior before 0.9.0 update
# uncomment to enable it

# disable-kick-when-online: true

# Config version DO NOT CHANGE!!!!
config-version: 1
Binary file removed localDependencies/ajd4jp-8.0.2.2021.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions project/scalapb.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.28")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.10.1"
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.11"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
USE seichiassist;

-- 型を変えるので一度内容をリセットする
UPDATE playerdata SET newVotingFairyTime = NULL;
ALTER TABLE playerdata MODIFY newVotingFairyTime DATETIME;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
USE seichiassist;

ALTER TABLE playerdata ADD is_fairy_speech_play_sound BOOLEAN DEFAULT TRUE AFTER toggleVotingFairy;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- 本来重複しないはずのuuidにunique制約をかけていなかった &
-- それによって何故か全く同じデータをもつデータがplayerdataテーブルに存在しているのでそれを取り除く

USE seichiassist;

CREATE TEMPORARY TABLE playerdata_tmp AS SELECT DISTINCT * FROM playerdata;
TRUNCATE TABLE playerdata;

INSERT INTO playerdata SELECT * FROM playerdata_tmp;
DROP TABLE playerdata_tmp;

-- ゆるせないのでplayerdataテーブルのuuidカラムをprimary keyとして設定する

ALTER TABLE playerdata ADD PRIMARY KEY(uuid)
38 changes: 38 additions & 0 deletions src/main/resources/db/migration/V1.16.3__Move_vote_column.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
USE seichiassist;

CREATE TABLE IF NOT EXISTS vote(
uuid CHAR(36) NOT NULL PRIMARY KEY,
vote_number INT NOT NULL,
chain_vote_number INT NOT NULL,
effect_point INT NOT NULL,
given_effect_point INT NOT NULL,
last_vote DATETIME
);

INSERT INTO
vote(
uuid,
vote_number,
chain_vote_number,
effect_point,
given_effect_point,
last_vote
)
SELECT
uuid,
p_vote,
chainvote,
effectpoint,
p_givenvote,
CASE
WHEN lastvote REGEXP '[0-9]{4}/[0-9]{2}/[0-9]{2}' THEN CONVERT(lastvote, DATE)
END
FROM
playerdata;

ALTER TABLE
playerdata DROP IF EXISTS p_vote,
DROP IF EXISTS chainvote,
DROP IF EXISTS effectpoint,
DROP IF EXISTS p_givenvote,
DROP IF EXISTS lastvote;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
USE seichiassist;

CREATE TABLE vote_fairy(
uuid CHAR(36) NOT NULL PRIMARY KEY,
apple_open_state INT NOT NULL DEFAULT 1,
fairy_summon_cost INT NOT NULL DEFAULT 1,
is_fairy_using BOOLEAN NOT NULL DEFAULT false,
fairy_recovery_mana_value INT NOT NULL DEFAULT 0,
fairy_end_time DATETIME DEFAULT NULL,
given_apple_amount BIGINT NOT NULL DEFAULT 0,
is_play_fairy_speech_sound BOOLEAN NOT NULL DEFAULT true
);

INSERT INTO
vote_fairy(
uuid,
apple_open_state,
fairy_summon_cost,
is_fairy_using,
fairy_recovery_mana_value,
fairy_end_time,
given_apple_amount,
is_play_fairy_speech_sound
)
SELECT
uuid,
toggleGiveApple,
toggleVotingFairy,
canVotingFairyUse,
VotingFairyRecoveryValue,
newVotingFairyTime,
p_apple,
is_fairy_speech_play_sound
FROM
playerdata;

ALTER TABLE playerdata
DROP IF EXISTS toggleGiveApple,
DROP IF EXISTS toggleVotingFairy,
DROP IF EXISTS canVotingFairyUse,
DROP IF EXISTS VotingFairyRecoveryValue,
DROP IF EXISTS newVotingFairyTime,
DROP IF EXISTS p_apple,
DROP IF EXISTS is_fairy_speech_play_sound
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.Listener

class System[F[_]: ConcurrentEffect: Timer](
val finalizer: PlayerDataFinalizer[F, Player],
val finalizers: List[PlayerDataFinalizer[F, Player]],
messagePublishingContext: ContextShift[IO]
)(
implicit configuration: Configuration,
Expand All @@ -26,6 +26,6 @@ class System[F[_]: ConcurrentEffect: Timer](
implicit val _synchronization: BungeeSemaphoreSynchronization[F[Unit], PlayerName] = {
new RedisBungeeSemaphoreSynchronization[F]()
}
Seq(new BungeeSemaphoreCooperator[F](finalizer))
Seq(new BungeeSemaphoreCooperator[F](finalizers))
}
}
Loading

0 comments on commit 02bbd8a

Please sign in to comment.