Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
dcc9f23
feat: add core module
sysnote8main Apr 14, 2026
ff8cea5
feat: add kotest and include spigot&paper-api on test
sysnote8main Apr 15, 2026
34f6697
feat: implement StatusLine system
sysnote8main Apr 15, 2026
13584b0
feat: add test for StatusLine generator
sysnote8main Apr 15, 2026
b83003f
feat: use StatusLine generator in main module
sysnote8main Apr 15, 2026
261e7b5
chore: remove unused code
sysnote8main Apr 15, 2026
4e7e7f5
chore: apply format
sysnote8main Apr 15, 2026
e65d584
chore: more simple
sysnote8main Apr 15, 2026
dff9ad2
chore: little format
sysnote8main Apr 17, 2026
2bfa814
feat: add SclatConfig class
sysnote8main Apr 17, 2026
1fbf8f8
feat: make it works and add test for them
sysnote8main Apr 17, 2026
b534c23
feat: migrate to better dependency handling
sysnote8main Apr 17, 2026
19be93e
feat: remove version catalog because of multi project
sysnote8main Apr 17, 2026
64abbcd
feat: spread version to all project
sysnote8main Apr 17, 2026
5d3fd5f
chore: suppress warning
sysnote8main Apr 17, 2026
3a0b684
feat: migrate to core module
sysnote8main Apr 17, 2026
c2fa27f
feat: use non-null list for commands in StatusClient
sysnote8main Apr 17, 2026
1c7f809
feat: move uuid serializer to code module
sysnote8main Apr 17, 2026
a51c47c
chore: more simple handle for entity click
sysnote8main Apr 17, 2026
b310205
feat: more simple packet listener registration
sysnote8main Apr 17, 2026
15afb8e
chore: move TickSchedular
sysnote8main Apr 17, 2026
7b56416
chore: apply format
sysnote8main Apr 17, 2026
8cf6057
chore: make it more simple
sysnote8main Apr 17, 2026
2aa801d
feat: add UUIDSerializer test
sysnote8main Apr 17, 2026
6f99df7
feat: migrate utils package to core module
sysnote8main Apr 17, 2026
46e9a90
feat: add test cases for DailyRefreshSet and TextAnimation
sysnote8main Apr 17, 2026
1101686
feat: add DelegatedLogger and test for it
sysnote8main Apr 19, 2026
b9599b6
feat: add PLUGIN_NAME to Variables.kt
sysnote8main Apr 19, 2026
f43b367
feat: migrate Plugins to core module and write test
sysnote8main Apr 19, 2026
bc644e5
feat: migrate Sphere to core module
sysnote8main Apr 19, 2026
6f1bdc9
feat: add gui system temporary
sysnote8main Apr 19, 2026
aa1f67e
feat: add test for Sphere
sysnote8main Apr 19, 2026
d2c9d68
feat: collect extensions to core module side
sysnote8main Apr 20, 2026
c604743
feat: migrate some config classes to core module
sysnote8main Apr 20, 2026
bc8630d
feat: remove redundant wrap class for loginbonus
sysnote8main Apr 20, 2026
93c9eaf
feat: move NewConfig class to core module
sysnote8main Apr 20, 2026
dd27f39
feat: migrate Config class to core module
sysnote8main Apr 20, 2026
69463de
feat: migrate some config classes to core module
sysnote8main Apr 20, 2026
5c574cd
feat: remove sclatLogger and use DelegatedLogger instead
sysnote8main Apr 20, 2026
82612da
feat: move some classes to core module
sysnote8main Apr 20, 2026
4c4a516
feat: move MineStat class to core module
sysnote8main Apr 20, 2026
89035d0
feat: add test case for MineStat
sysnote8main Apr 20, 2026
e1f83cb
feat: add test case for Team.kt
sysnote8main Apr 20, 2026
2eddb65
feat: remove unused method in AsyncThreadManager.kt
sysnote8main Apr 21, 2026
7f16a33
feat: more simple handling for glow enchant
sysnote8main Apr 21, 2026
19ee9b4
feat: more simple condition check for SquidListenerMgr.kt
sysnote8main Apr 21, 2026
d9aa3d8
feat: more simple handling
sysnote8main Apr 21, 2026
b69c549
feat: make more simple squid mode condition check
sysnote8main Apr 22, 2026
6ae80f3
feat: move Path.kt to core module
sysnote8main Apr 22, 2026
7780238
feat: remove usage of plugin instance
sysnote8main Apr 22, 2026
bf8f4f4
feat: remove ktlint
sysnote8main Apr 22, 2026
9003e04
chore: temp commit
sysnote8main Apr 26, 2026
dc21b2e
feat: add deprecation
sysnote8main Apr 26, 2026
65881a2
feat: migrate all protocollib instance to Packets.kt
sysnote8main Apr 26, 2026
d9becab
chore: specify type for protocolManager instance
sysnote8main Apr 26, 2026
944e3f6
feat: use map instead of list
sysnote8main Apr 26, 2026
45c8801
feat: rename Team to SclatTeam
sysnote8main Apr 26, 2026
bfe87fd
feat: update some action in Area.kt
sysnote8main Apr 26, 2026
58ce13e
feat: more simple handling
sysnote8main Apr 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 71 additions & 70 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,61 +1,89 @@
// Gradle 9.0.0 can't run in Java8
plugins {
`java-library`
`maven-publish`
alias(libs.plugins.ktlint)
alias(libs.plugins.shadow)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
id("io.kotest") version "6.1.11"
id("com.gradleup.shadow") version "8.3.10"
id("org.jetbrains.kotlin.jvm") version "2.3.20"
id("org.jetbrains.kotlin.plugin.serialization") version "2.3.20"
}

group = "be4rjp"
version = System.getenv("VERSION") ?: "1.0-SNAPSHOT"
description = "Sclat"

repositories {
mavenCentral()
maven("https://jitpack.io/")
maven("https://repo.papermc.io/repository/maven-public/")
exclusiveContent {
forRepository {
mavenLocal()
allprojects {
apply {
plugin("io.kotest")
plugin("org.jetbrains.kotlin.jvm")
plugin("org.jetbrains.kotlin.plugin.serialization")
}

version = System.getenv("VERSION") ?: "1.0-SNAPSHOT"

repositories {
mavenCentral()
maven("https://jitpack.io/")
maven("https://repo.papermc.io/repository/maven-public/")
exclusiveContent {
forRepository {
mavenLocal()
}
filter {
includeGroup("org.spigotmc")
}
}
filter {
includeGroup("org.spigotmc")
exclusiveContent {
forRepository {
maven("https://repo.codemc.io/repository/maven-public/")
}
filter {
includeGroup("org.bstats")
}
}
}
exclusiveContent {
forRepository {
maven("https://repo.codemc.io/repository/maven-public/")
}
filter {
includeGroup("org.bstats")

dependencies {
compileOnly("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
compileOnly("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
compileOnly("com.github.koca2000:NoteBlockAPI:1.6.3")
compileOnly("com.github.ucchyocean:LunaChat:3.0.16")
compileOnly("net.dmulloy2:ProtocolLib:5.1.0")
compileOnly("com.github.Be4rJP:DADADAChecker:1.0.0")
compileOnly("com.github.Be4rJP:BlockStudio:-SNAPSHOT")

implementation("net.mamoe.yamlkt:yamlkt:0.13.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0-rc01")
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.22.0")
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.22.0")
implementation("org.incendo:cloud-paper:2.0.0-SNAPSHOT") // found newer 2.0.0-beta.10
implementation("org.jspecify:jspecify:1.0.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("fr.mrmicky:fastboard:2.1.5")
implementation("com.akuleshov7:ktoml-core:0.7.1")

testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("io.kotest:kotest-runner-junit5:6.1.11")
testImplementation("io.kotest:kotest-assertions-core:6.1.11")
testImplementation("io.kotest:kotest-property:6.1.11")
testImplementation("io.mockk:mockk:1.14.9")
testImplementation("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
testImplementation("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
testImplementation("ch.qos.logback:logback-classic:1.4.11")
}

val targetJavaVersion: Int = 11

kotlin {
jvmToolchain(targetJavaVersion)
}

tasks {
test {
useJUnitPlatform()
}
}
}

dependencies {
compileOnly(libs.spigot)
compileOnly(libs.noteblockapi)
compileOnly(libs.lunachat)
compileOnly(libs.protocolLib)
compileOnly(libs.dadadachecker)
compileOnly(libs.blockstudio)
compileOnly(libs.paperApi)
implementation(libs.cloudPaper)
implementation(libs.jspecify)
implementation(libs.kotlin.stdlib)
implementation(libs.yamlkt)
implementation(libs.fastboard)
implementation(libs.bundles.ktoml)
}

// Project Settings
val targetJavaVersion: Int = 11
val defaultEncoding: String = "UTF-8"

kotlin {
jvmToolchain(targetJavaVersion)
implementation(project("core"))
}

tasks {
Expand All @@ -71,30 +99,3 @@ tasks {
archiveFileName.set("Sclat.jar")
}
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
artifact(tasks.jar)
}
}

repositories {
maven {
name = "azisaba-repo"
credentials {
username = System.getenv("REPO_USERNAME")
password = System.getenv("REPO_PASSWORD")
}
url =
if (project.version.toString().endsWith("-SNAPSHOT")) {
uri("https://repo.azisaba.net/repository/maven-snapshots/")
} else {
uri("https://repo.azisaba.net/repository/maven-releases/")
}
}
}
}
4 changes: 4 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
group = "net.azisaba.sclat"

dependencies {
}
29 changes: 29 additions & 0 deletions core/src/main/kotlin/net/azisaba/sclat/core/DelegatedLogger.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.azisaba.sclat.core

import org.slf4j.Logger
import org.slf4j.LoggerFactory
import kotlin.reflect.KProperty

/**
* Example:
* ```kotlin
* val logger by DelegatedLogger()
* ```
*/
class DelegatedLogger {
private var logger: Logger? = null

// TestClass2, KProperty1<*, *>
operator fun <T : Any> getValue(
thisRef: T,
property: KProperty<*>,
): Logger =
logger ?: run {
val className =
thisRef::class.java.name
.removeSuffix("\$Companion")
.split(".")
.last()
LoggerFactory.getLogger("$PLUGIN_NAME:$className").also { logger = it }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package be4rjp.sclat.api
package net.azisaba.sclat.core

import be4rjp.sclat.sclatLogger
import org.bukkit.Bukkit
import org.bukkit.plugin.PluginManager
import java.util.function.Consumer

enum class Plugins(
Expand All @@ -17,45 +16,33 @@ enum class Plugins(
PROTOCOLLIB("ProtocolLib"),
;

private var _isLoaded: Boolean? = null

val isLoaded: Boolean
get() {
if (_isLoaded == null) {
_isLoaded = Bukkit.getPluginManager().isPluginEnabled(pluginName)
}
return _isLoaded!!
}

/**
* To support plugman load.
*/
private fun resetLoadedState() {
_isLoaded = null
}
var isLoaded: Boolean = false
private set

companion object {
private val logger by DelegatedLogger()

/**
* Initialize check
*
* @return is init-check succeeded
*/
@JvmStatic
fun onInit(): Boolean {
val missingPlugins = ArrayList<String?>()
fun onInit(pluginManager: PluginManager): Boolean {
val missingPlugins = ArrayList<String>()
for (plugin in entries) {
plugin.resetLoadedState()
plugin.isLoaded = pluginManager.isPluginEnabled(plugin.pluginName)
if (!plugin.isLoaded && plugin.isRequired) {
missingPlugins.add(plugin.pluginName)
}
}

// If some required plugins are missing
if (!missingPlugins.isEmpty()) {
sclatLogger.error("Some plugins are missing. Please install or enable.")
sclatLogger.error("*** Missing required plugins ***")
missingPlugins.forEach(Consumer { p: String? -> sclatLogger.error("- {}", p) })
sclatLogger.error("********************************")
logger.error("Some plugins are missing. Please install or enable.")
logger.error("*** Missing required plugins ***")
missingPlugins.forEach(Consumer { p: String? -> logger.error("- {}", p) })
logger.error("********************************")
return false
}

Expand Down
37 changes: 37 additions & 0 deletions core/src/main/kotlin/net/azisaba/sclat/core/Sclat.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.azisaba.sclat.core

import be4rjp.dadadachecker.DADADACheckerAPI
import com.comphenix.protocol.ProtocolLibrary
import com.comphenix.protocol.ProtocolManager
import net.azisaba.sclat.core.config.SclatConfig
import org.bukkit.plugin.java.JavaPlugin

class Sclat : JavaPlugin() {
private lateinit var protocolManager: ProtocolManager
private lateinit var dadadaCheckerApi: DADADACheckerAPI
private lateinit var config: SclatConfig

override fun onEnable() {
slfLogger.info("Welcome to Sclat! (=^・ω・^=)")

if (!Plugins.onInit(server.pluginManager)) {
slfLogger.error("✘ Failed to check depend plugins. Disabling...")
server.pluginManager.disablePlugin(this)
return
}
slfLogger.info("✔ Checked depend plugins.")

protocolManager = ProtocolLibrary.getProtocolManager()
dadadaCheckerApi = DADADACheckerAPI(this)
slfLogger.info("✔ Initialized ProtocolLib and DADADA Checker API.")
}

override fun onDisable() {
slfLogger.info("Bye bye! (ノ´ヮ`)ノ*: ・゚")
}

companion object {
// use slfLogger instead because logger was already taken by JavePlugin
private val slfLogger by DelegatedLogger()
}
}
3 changes: 3 additions & 0 deletions core/src/main/kotlin/net/azisaba/sclat/core/Variables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package net.azisaba.sclat.core

const val PLUGIN_NAME: String = "Sclat"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package be4rjp.sclat.config
package net.azisaba.sclat.core.config

import org.bukkit.Bukkit
import org.bukkit.configuration.file.FileConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package be4rjp.sclat.api.config
package net.azisaba.sclat.core.config

import be4rjp.sclat.sclatLogger
import net.azisaba.sclat.core.DelegatedLogger
import org.bukkit.configuration.file.FileConfiguration
import org.bukkit.configuration.file.YamlConfiguration
import org.bukkit.plugin.Plugin
Expand All @@ -20,7 +20,7 @@ class CustomConfig(
if (configFile.exists()) return

plugin.saveResource(file, false)
sclatLogger.info("デフォルトの設定ファイルを書き込みました。")
logger.info("デフォルトの設定ファイルを書き込みました。")
}

fun getConfig(): FileConfiguration? {
Expand All @@ -35,7 +35,7 @@ class CustomConfig(
try {
getConfig()!!.save(configFile)
} catch (ex: IOException) {
sclatLogger.error("Could not save config to $configFile", ex)
logger.error("Could not save config to $configFile", ex)
}
}

Expand All @@ -48,4 +48,8 @@ class CustomConfig(
YamlConfiguration.loadConfiguration(InputStreamReader(defConfigStream, StandardCharsets.UTF_8)),
)
}

companion object {
private val logger by DelegatedLogger()
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package be4rjp.sclat.config
package net.azisaba.sclat.core.config

import kotlinx.serialization.Serializable

Expand Down
Loading
Loading