Skip to content

Commit

Permalink
Project cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasgrose committed Oct 19, 2024
1 parent 8aaeb22 commit 2ec8f01
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ gradle-app.setting

# Paper run
run/

# Gradle docker cache
.gradleDocker
5 changes: 4 additions & 1 deletion .idea/misc.xml

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

1 change: 1 addition & 0 deletions .idea/modules.xml

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

9 changes: 9 additions & 0 deletions .idea/modules/Gateway.iml

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

4 changes: 4 additions & 0 deletions .idea/modules/Gateway.main.iml

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

24 changes: 24 additions & 0 deletions .idea/runConfigurations/Gateway__qodanaScan_.xml

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

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

3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.run.paper)
alias(libs.plugins.ktlint)
alias(libs.plugins.detekt)
alias(libs.plugins.qodana)
}

val version: String by project
Expand Down Expand Up @@ -91,7 +92,7 @@ tasks {
mustRunAfter(ktlintFormat)
}

create("runChecks") {
create("runLints") {
dependsOn(ktlintFormat, detekt)
}

Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ runPaper = "2.3.1"
ktlint-plugin = "12.1.1"
# https://detekt.dev/
detekt-plugin = "1.23.7"
# https://www.jetbrains.com/help/qodana/qodana-gradle-plugin.html
qodana = "2024.2.3"

[libraries]
paper-api = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper-api" }
Expand All @@ -45,3 +47,4 @@ 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" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt-plugin" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
12 changes: 12 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Qodana configuration:
# https://www.jetbrains.com/help/qodana/qodana-yaml.html

version: 1.0
linter: jetbrains/qodana-jvm-community:2024.2
projectJDK: "21"
profile:
name: qodana.recommended
exclude:
- name: All
paths:
- .qodana
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ open class CommonDecoder : NullHandlingDecoder<Any> {
* @param classifier The class we want to check
* @return true if it passes all conditions, false otherwise
*/
fun isSupportedClassifier(classifier: KClass<*>): Boolean =
private fun isSupportedClassifier(classifier: KClass<*>): Boolean =
!classifier.isData && !classifier.isSealed && !classifier.isInline() && classifier canBe ConfigObject::class
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import dev.kord.rest.builder.message.create.FollowupMessageCreateBuilder
* @receiver Editing paginator builder
*
* @see group
* @see editingPaginator
*/
suspend fun <T : Any> EphemeralSlashCommandContext<*, *>.groupAndPaginateItems(
displayItems: Collection<T>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ open class ConfigListArgs<T : Any, A : ConfigListArgs<T, A, P>, P : ArgParser<T,
* @param stringValidator The validator to use for each string
*/
class StringListConfigArgs(
val stringCompleter: StringParser<StringListConfigArgs>.(
private val stringCompleter: StringParser<StringListConfigArgs>.(
TabCompleteContext<StringListConfigArgs>,
) -> List<String>,
val stringValidator: StringParser<StringListConfigArgs>.(
private val stringValidator: StringParser<StringListConfigArgs>.(
ParseResult.Success<String, StringListConfigArgs>,
) -> Boolean,
) : ConfigListArgs<String, StringListConfigArgs, StringParser<StringListConfigArgs>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender
* @property args The args that exist for the action
* @constructor Create a Bukkit context
*/
public sealed class BukkitContext(
sealed class BukkitContext(
val sender: CommandSender,
val command: Command,
val args: Array<String>,
Expand All @@ -26,7 +26,7 @@ public sealed class BukkitContext(
* @param command The command that is completing
* @param args The args that exist at the moment of completion
*/
public class TabComplete(
class TabComplete(
sender: CommandSender,
command: Command,
val alias: String,
Expand All @@ -43,7 +43,7 @@ public sealed class BukkitContext(
* @param command The command that is executing
* @param args The args that were passed in for execution
*/
public class CommandExecute(
class CommandExecute(
sender: CommandSender,
command: Command,
val label: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.rose.gateway.minecraft.commands.framework.runner.CommandArgs
* @property args The args in use
* @constructor Create a framework context
*/
public sealed class FrameworkContext<A : CommandArgs<A>>(
sealed class FrameworkContext<A : CommandArgs<A>>(
val command: Command,
val args: A,
) {
Expand All @@ -27,7 +27,7 @@ public sealed class FrameworkContext<A : CommandArgs<A>>(
* @param command The command in use
* @param args The args in use
*/
public sealed class BukkitCommand<B : BukkitContext, A : CommandArgs<A>>(
sealed class BukkitCommand<B : BukkitContext, A : CommandArgs<A>>(
val bukkit: B,
command: Command,
args: A,
Expand All @@ -42,7 +42,7 @@ public sealed class FrameworkContext<A : CommandArgs<A>>(
* @param command The command in use
* @param args The args in use
*/
public class CommandExecute<A : CommandArgs<A>>(
class CommandExecute<A : CommandArgs<A>>(
bukkit: BukkitContext.CommandExecute,
command: Command,
args: A,
Expand All @@ -59,7 +59,7 @@ public sealed class FrameworkContext<A : CommandArgs<A>>(
* @param command The command in use
* @param args The args in use
*/
public class TabComplete<A : CommandArgs<A>>(
class TabComplete<A : CommandArgs<A>>(
bukkit: BukkitContext.TabComplete,
command: Command,
args: A,
Expand All @@ -71,9 +71,9 @@ public sealed class FrameworkContext<A : CommandArgs<A>>(
/**
* @see FrameworkContext.BukkitCommand.CommandExecute
*/
public typealias CommandExecuteContext<A> = FrameworkContext.BukkitCommand.CommandExecute<A>
typealias CommandExecuteContext<A> = FrameworkContext.BukkitCommand.CommandExecute<A>

/**
* @see FrameworkContext.BukkitCommand.TabComplete
*/
public typealias TabCompleteContext<A> = FrameworkContext.BukkitCommand.TabComplete<A>
typealias TabCompleteContext<A> = FrameworkContext.BukkitCommand.TabComplete<A>
8 changes: 4 additions & 4 deletions src/main/kotlin/com/rose/gateway/minecraft/component/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ object Color : KoinComponent {
*
* @return The colored component
*/
public fun Component.primary(): Component = this.color(config.primaryColor())
fun Component.primary(): Component = this.color(config.primaryColor())

/**
* Apply the secondary color to the component
*
* @return The colored component
*/
public fun Component.secondary(): Component = this.color(config.secondaryColor())
fun Component.secondary(): Component = this.color(config.secondaryColor())

/**
* Apply the tertiary color to the component
*
* @return The colored component
*/
public fun Component.tertiary(): Component = this.color(config.tertiaryColor())
fun Component.tertiary(): Component = this.color(config.tertiaryColor())

/**
* Apply the warning color to the component
*
* @return The colored component
*/
public fun Component.warning(): Component = this.color(config.warningColor())
fun Component.warning(): Component = this.color(config.warningColor())
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.util.logging.SimpleFormatter
class LogFormatter : SimpleFormatter() {
private val dateTimeFormatter = DateTimeFormatter.ofPattern("EEE, yyyy-MM-dd HH:mm:ss")

override fun format(record: LogRecord): String? {
override fun format(record: LogRecord): String {
val zdt =
ZonedDateTime.ofInstant(
record.instant,
Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/com/rose/gateway/minecraft/logging/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import java.util.logging.FileHandler
object Logger : KoinComponent {
private val plugin: GatewayPlugin by inject()
private val pluginLogger = plugin.logger
private val handler: FileHandler
private val handler: FileHandler = FileHandler(plugin.dataFolder.path.plus("/gateway_log.txt"), true)

init {
handler = FileHandler(plugin.dataFolder.path.plus("/gateway_log.txt"), true)
handler.formatter = LogFormatter()
pluginLogger.addHandler(handler)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object ServerInfo {
* @property fifteenMinute The TPS over the past fifteen minutes
* @constructor Create a TPS snapshot
*/
public data class TPS(
data class TPS(
val oneMinute: Double,
val fiveMinute: Double,
val fifteenMinute: Double,
Expand Down

0 comments on commit 2ec8f01

Please sign in to comment.