diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml
index 02a7d9f0..8255c2b5 100644
--- a/.github/workflows/publish_release.yml
+++ b/.github/workflows/publish_release.yml
@@ -47,7 +47,7 @@ jobs:
- name: Build artifacts
uses: gradle/actions/setup-gradle@v3
with:
- arguments: build
+ arguments: shadowJar
# https://github.com/marketplace/actions/create-release
- name: Create release
diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml
index 096c49aa..12675da6 100644
--- a/.github/workflows/pull_request_check.yml
+++ b/.github/workflows/pull_request_check.yml
@@ -32,7 +32,7 @@ jobs:
- name: Build artifacts
uses: gradle/actions/setup-gradle@v3
with:
- arguments: build --stacktrace
+ arguments: shadowJar
ktlint:
runs-on: ubuntu-latest
@@ -63,4 +63,3 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
detekt_config: config/detekt/detekt.yml
detekt_build_upon_default_config: true
- reporter: github-pr-review
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 3ae08c1f..5d2c2fff 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -36,5 +36,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index bd523c22..ac9b1184 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -25,5 +25,5 @@
-
+
\ No newline at end of file
diff --git a/.idea/modules/Gateway.main.iml b/.idea/modules/Gateway.main.iml
index 746f1fd6..bbeeb3ec 100644
--- a/.idea/modules/Gateway.main.iml
+++ b/.idea/modules/Gateway.main.iml
@@ -11,8 +11,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/Gateway__build_.xml b/.idea/runConfigurations/Gateway__shadowJar_.xml
similarity index 80%
rename from .idea/runConfigurations/Gateway__build_.xml
rename to .idea/runConfigurations/Gateway__shadowJar_.xml
index 3fb80dd3..91787802 100644
--- a/.idea/runConfigurations/Gateway__build_.xml
+++ b/.idea/runConfigurations/Gateway__shadowJar_.xml
@@ -1,5 +1,5 @@
-
+
@@ -10,7 +10,7 @@
@@ -18,6 +18,7 @@
true
true
false
+ false
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 8ed7110b..dafe4070 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,9 +1,11 @@
+import dev.kordex.gradle.plugins.kordex.DataCollection
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
+ alias(libs.plugins.kordex)
alias(libs.plugins.shadow)
alias(libs.plugins.run.paper)
alias(libs.plugins.ktlint)
@@ -14,6 +16,8 @@ plugins {
val version: String by project
val group: String by project
+val jvmTargetVersion: String by project
+val kotlinTargetVersion: String by project
val minecraftTestVersion: String by project
val ktlintVersion: String by project
@@ -25,8 +29,8 @@ project.version = version
repositories {
mavenCentral()
gradlePluginPortal()
+ maven("https://repo.kordex.dev/snapshots/")
maven("https://repo.papermc.io/repository/maven-public/")
- maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
maven("https://jitpack.io")
}
@@ -34,30 +38,36 @@ dependencies {
compileOnly(libs.paper.api)
implementation(libs.bundles.hoplite)
implementation(libs.kaml)
- implementation(libs.kordex)
implementation(libs.tegral)
}
-ktlint {
- version.set(ktlintVersion)
-}
-
detekt {
config.from("config/detekt/detekt.yml")
buildUponDefaultConfig = true
toolVersion = detektVersion
}
-java {
- toolchain.languageVersion = JavaLanguageVersion.of(21)
+ktlint {
+ version = ktlintVersion
+}
+
+kordEx {
+ jvmTarget = jvmTargetVersion.toInt()
+
+ bot {
+ // See https://docs.kordex.dev/data-collection.html
+ dataCollection(DataCollection.Standard)
+
+ mainClass = "com.rose.gateway.discord.bot.DiscordBotKt"
+ }
}
tasks {
compileKotlin {
compilerOptions {
- jvmTarget = JvmTarget.JVM_21
- apiVersion = KotlinVersion.KOTLIN_2_0
- languageVersion = KotlinVersion.KOTLIN_2_0
+ jvmTarget = JvmTarget.fromTarget(jvmTargetVersion)
+ apiVersion = KotlinVersion.fromVersion(kotlinTargetVersion)
+ languageVersion = KotlinVersion.fromVersion(kotlinTargetVersion)
}
}
@@ -80,10 +90,6 @@ tasks {
mergeServiceFiles()
}
- build {
- dependsOn(shadowJar)
- }
-
runServer {
this.minecraftVersion(minecraftTestVersion)
}
diff --git a/gradle.properties b/gradle.properties
index a4354c00..5fe6cb0a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,9 @@
# Project info
version=1.6.3
group=com.rose.gateway
+# Target versions for compiled app
+jvmTargetVersion=21
+kotlinTargetVersion=2.0
# Version to use for testing
minecraftTestVersion=1.21.1
# Code style configuration
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index af7daf15..02ec5de7 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -8,8 +8,8 @@ paper-api = "1.21.1-R0.1-SNAPSHOT"
hoplite = "2.8.2"
# https://github.com/charleskorn/kaml
kaml = "0.61.0"
-# https://kordex.kotlindiscord.com/
-kordex = "1.9.0-SNAPSHOT"
+# https://docs.kordex.dev/getting-started
+kordexPlugin = "1.4.2"
# https://tegral.zoroark.guru/docs/modules/core/niwen/
tegral = "0.0.4"
@@ -34,7 +34,6 @@ paper-api = { group = "io.papermc.paper", name = "paper-api", version.ref = "pap
hoplite-core = { group = "com.sksamuel.hoplite", name = "hoplite-core", version.ref = "hoplite" }
hoplite-yaml = { group = "com.sksamuel.hoplite", name = "hoplite-yaml", version.ref = "hoplite" }
kaml = { group = "com.charleskorn.kaml", name = "kaml", version.ref = "kaml" }
-kordex = { group = "com.kotlindiscord.kord.extensions", name = "kord-extensions", version.ref = "kordex" }
tegral = { group = "guru.zoroark.tegral", name = "tegral-niwen-lexer", version.ref = "tegral" }
[bundles]
@@ -43,6 +42,7 @@ hoplite = ["hoplite-core", "hoplite-yaml"]
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
+kordex = { id = "dev.kordex.gradle.kordex", version.ref = "kordexPlugin" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" }
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/DiscordBot.kt b/src/main/kotlin/com/rose/gateway/discord/bot/DiscordBot.kt
index 8bf9efe3..6df106e0 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/DiscordBot.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/DiscordBot.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot
-import com.kotlindiscord.kord.extensions.ExtensibleBot
-import com.kotlindiscord.kord.extensions.utils.loadModule
import com.rose.gateway.GatewayPlugin
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.botToken
@@ -10,6 +8,8 @@ import com.rose.gateway.minecraft.logging.Logger
import com.rose.gateway.shared.concurrency.PluginCoroutineScope
import dev.kord.core.Kord
import dev.kord.core.exception.KordInitializationException
+import dev.kordex.core.ExtensibleBot
+import dev.kordex.core.utils.loadModule
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import org.koin.core.component.KoinComponent
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/checks/MessageCheck.kt b/src/main/kotlin/com/rose/gateway/discord/bot/checks/MessageCheck.kt
index 99454299..d4723a70 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/checks/MessageCheck.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/checks/MessageCheck.kt
@@ -1,10 +1,10 @@
package com.rose.gateway.discord.bot.checks
-import com.kotlindiscord.kord.extensions.checks.channelFor
-import com.kotlindiscord.kord.extensions.checks.messageFor
-import com.kotlindiscord.kord.extensions.checks.types.Check
import com.rose.gateway.discord.bot.DiscordBotController
import dev.kord.core.Kord
+import dev.kordex.core.checks.channelFor
+import dev.kordex.core.checks.messageFor
+import dev.kordex.core.checks.types.Check
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/client/ClientInfo.kt b/src/main/kotlin/com/rose/gateway/discord/bot/client/ClientInfo.kt
index 213784d5..0a8af1cb 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/client/ClientInfo.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/client/ClientInfo.kt
@@ -1,9 +1,9 @@
package com.rose.gateway.discord.bot.client
-import com.kotlindiscord.kord.extensions.utils.permissionsForMember
import com.rose.gateway.discord.bot.DiscordBotController
import dev.kord.common.entity.Permissions
import dev.kord.core.entity.channel.GuildChannel
+import dev.kordex.core.utils.permissionsForMember
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ExtensionToggle.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ExtensionToggle.kt
index 01f3b021..0538c6f8 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ExtensionToggle.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ExtensionToggle.kt
@@ -1,6 +1,6 @@
package com.rose.gateway.discord.bot.extensions
-import com.kotlindiscord.kord.extensions.extensions.Extension
+import dev.kordex.core.extensions.Extension
import org.koin.core.component.KoinComponent
/**
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/about/AboutExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/about/AboutExtension.kt
index 5285d8a3..74448495 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/about/AboutExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/about/AboutExtension.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot.extensions.about
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.aboutExtensionEnabled
import com.rose.gateway.config.access.secondaryColor
@@ -9,6 +7,8 @@ import com.rose.gateway.discord.bot.extensions.ExtensionToggle
import com.rose.gateway.minecraft.logging.Logger
import dev.kord.common.Color
import dev.kord.rest.builder.message.embed
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.ephemeralSlashCommand
import org.bukkit.Bukkit
import org.koin.core.component.inject
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/ChatExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/ChatExtension.kt
index cad751b2..7e308bfe 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/ChatExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/ChatExtension.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot.extensions.chat
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.event
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.chatExtensionEnabled
import com.rose.gateway.discord.bot.checks.MessageCheck
@@ -9,6 +7,8 @@ import com.rose.gateway.discord.bot.extensions.ExtensionToggle
import com.rose.gateway.discord.bot.extensions.chat.processing.DiscordMessageProcessor
import com.rose.gateway.discord.bot.message.DiscordMessageSender
import com.rose.gateway.minecraft.server.Console
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.event
import org.koin.core.component.inject
/**
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/GameChatEvent.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/GameChatEvent.kt
index 702c9ad8..65aa9475 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/GameChatEvent.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/GameChatEvent.kt
@@ -1,9 +1,9 @@
package com.rose.gateway.discord.bot.extensions.chat
-import com.kotlindiscord.kord.extensions.events.KordExEvent
import com.rose.gateway.discord.bot.DiscordBot
import com.rose.gateway.discord.bot.DiscordBotController
import dev.kord.rest.builder.message.create.MessageCreateBuilder
+import dev.kordex.core.events.KordExEvent
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/processing/DiscordMessageProcessor.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/processing/DiscordMessageProcessor.kt
index 80002b9d..9aa2e3c5 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/processing/DiscordMessageProcessor.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/chat/processing/DiscordMessageProcessor.kt
@@ -1,6 +1,5 @@
package com.rose.gateway.discord.bot.extensions.chat.processing
-import com.kotlindiscord.kord.extensions.utils.getTopRole
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.secondaryColor
import com.rose.gateway.minecraft.component.atMember
@@ -17,6 +16,7 @@ import com.rose.gateway.shared.parsing.TextProcessor
import dev.kord.core.entity.Member
import dev.kord.core.entity.Message
import dev.kord.core.event.message.MessageCreateEvent
+import dev.kordex.core.utils.getTopRole
import kotlinx.coroutines.flow.toList
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.JoinConfiguration
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ip/IpExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ip/IpExtension.kt
index 39cb0524..5a34dbfc 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ip/IpExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/ip/IpExtension.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot.extensions.ip
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.displayIp
import com.rose.gateway.config.access.ipExtensionEnabled
@@ -10,6 +8,8 @@ import com.rose.gateway.discord.bot.extensions.ExtensionToggle
import com.rose.gateway.minecraft.logging.Logger
import dev.kord.common.Color
import dev.kord.rest.builder.message.embed
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.ephemeralSlashCommand
import org.koin.core.component.inject
/**
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/list/ListExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/list/ListExtension.kt
index e3df7220..83dee489 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/list/ListExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/list/ListExtension.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot.extensions.list
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.listExtensionEnabled
import com.rose.gateway.config.access.maxPlayersPerListPage
@@ -14,6 +12,8 @@ import com.rose.gateway.minecraft.server.ServerInfo
import com.rose.gateway.shared.text.plurality
import dev.kord.common.Color
import dev.kord.rest.builder.message.embed
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.ephemeralSlashCommand
import org.koin.core.component.inject
/**
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/tps/TpsExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/tps/TpsExtension.kt
index 60ee9b3c..05b1f798 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/tps/TpsExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/tps/TpsExtension.kt
@@ -1,7 +1,5 @@
package com.rose.gateway.discord.bot.extensions.tps
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.secondaryColor
import com.rose.gateway.config.access.tpsExtensionEnabled
@@ -9,6 +7,8 @@ import com.rose.gateway.discord.bot.extensions.ExtensionToggle
import com.rose.gateway.minecraft.server.ServerInfo
import dev.kord.common.Color
import dev.kord.rest.builder.message.embed
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.ephemeralSlashCommand
import org.koin.core.component.inject
import kotlin.math.roundToInt
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistArguments.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistArguments.kt
index d3a57f97..915b2b7e 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistArguments.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistArguments.kt
@@ -1,7 +1,7 @@
package com.rose.gateway.discord.bot.extensions.whitelist
-import com.kotlindiscord.kord.extensions.commands.Arguments
-import com.kotlindiscord.kord.extensions.commands.converters.impl.string
+import dev.kordex.core.commands.Arguments
+import dev.kordex.core.commands.converters.impl.string
/**
* Arguments for whitelist-related Discord commands
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistExtension.kt b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistExtension.kt
index 1f9064aa..b0121c6a 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistExtension.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/extensions/whitelist/WhitelistExtension.kt
@@ -1,9 +1,5 @@
package com.rose.gateway.discord.bot.extensions.whitelist
-import com.kotlindiscord.kord.extensions.commands.application.slash.EphemeralSlashCommandContext
-import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
-import com.kotlindiscord.kord.extensions.extensions.Extension
-import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.rose.gateway.config.PluginConfig
import com.rose.gateway.config.access.maxPlayersPerWhitelistPage
import com.rose.gateway.config.access.primaryColor
@@ -19,6 +15,10 @@ import com.rose.gateway.minecraft.whitelist.WhitelistState
import com.rose.gateway.shared.text.plurality
import dev.kord.common.Color
import dev.kord.rest.builder.message.embed
+import dev.kordex.core.commands.application.slash.EphemeralSlashCommandContext
+import dev.kordex.core.commands.application.slash.ephemeralSubCommand
+import dev.kordex.core.extensions.Extension
+import dev.kordex.core.extensions.ephemeralSlashCommand
import org.koin.core.component.inject
/**
diff --git a/src/main/kotlin/com/rose/gateway/discord/bot/message/GroupAndPaginateItems.kt b/src/main/kotlin/com/rose/gateway/discord/bot/message/GroupAndPaginateItems.kt
index eb1a4c59..73cab31f 100644
--- a/src/main/kotlin/com/rose/gateway/discord/bot/message/GroupAndPaginateItems.kt
+++ b/src/main/kotlin/com/rose/gateway/discord/bot/message/GroupAndPaginateItems.kt
@@ -1,9 +1,9 @@
package com.rose.gateway.discord.bot.message
-import com.kotlindiscord.kord.extensions.commands.application.slash.EphemeralSlashCommandContext
-import com.kotlindiscord.kord.extensions.pagination.builders.PaginatorBuilder
import com.rose.gateway.shared.collections.group
import dev.kord.rest.builder.message.create.FollowupMessageCreateBuilder
+import dev.kordex.core.commands.application.slash.EphemeralSlashCommandContext
+import dev.kordex.core.pagination.builders.PaginatorBuilder
/**
* Groups the items of a collection and then displays them in a paginator if any exist