From b1f80adb204ccf1d41b26725cc003c6019c01c5f Mon Sep 17 00:00:00 2001 From: Nicholas Rose <35816886+nicholasgrose@users.noreply.github.com> Date: Sat, 19 Oct 2024 18:29:35 -0500 Subject: [PATCH] Update to Minecraft 1.21.1 (#95) * Fixing up workflow branch names * Improve bot initialization and error handling (#91) * Project file updates * Updated dependencies, formatters, and plugins * Made final changes from ktlint * Bumped kotlin to 1.9.21 * Trying to get this file to finally commit with the correct formatting * Bumped Gradle version * Removed lixy because it is deprecated. I am now using its successor library * Replaced the tegral catalog with the lexer library directly to ease version management * Bump patch version to prep a patch release * Minor fix to documentation * Fixing broken pull request check * Bumped kordex to 1.7.0-snapshot * Bumped dependencies * Fixed some code style weirdness * Update dependencies * Updating dependencies and gradle * Simplify the project files a bit * Simplify the project files a bit * Project cleanup --- .editorconfig | 14 +- .github/workflows/publish_release.yml | 108 +- .github/workflows/pull_request_check.yml | 100 +- .gitignore | 3 + .idea/.gitignore | 8 - .idea/aws.xml | 16 - .idea/checkstyle-idea.xml | 16 - .idea/checkstyleidea-libs/readme.txt | 6 - .idea/codeStyles/Project.xml | 24 - .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/compiler.xml | 2 +- .idea/detekt.xml | 16 - .idea/discord.xml | 7 - .idea/encodings.xml | 6 - .idea/{ktor.xml => git_toolbox_blame.xml} | 4 +- .idea/git_toolbox_prj.xml | 5 - .idea/inspectionProfiles/Project_Default.xml | 3274 ----------------- .idea/jarRepositories.xml | 30 +- .idea/kotlinc.xml | 2 +- .idea/ktlint-plugin.xml | 6 + .idea/ktlint.xml | 11 - .idea/misc.xml | 29 +- .idea/modules.xml | 4 - .idea/modules/Gateway.iml | 1 + .idea/modules/Gateway.main.iml | 6 +- .idea/modules/Gateway.test.iml | 13 - .idea/modules/GitHub.Gateway.main.iml | 13 - .../modules/Projects.GitHub.Gateway.main.iml | 14 - .../modules/com.rose.gateway.Gateway.main.iml | 13 - .../Gateway__qodanaScan_.xml | 24 + ..._runChecks_.xml => Gateway__runLints_.xml} | 5 +- build.gradle.kts | 88 +- gradle.properties | 28 +- gradle/libs.versions.toml | 50 + gradle/wrapper/gradle-wrapper.jar | Bin 63375 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 19 +- gradlew.bat | 20 +- qodana.yaml | 12 + .../kotlin/com/rose/gateway/GatewayPlugin.kt | 4 +- .../rose/gateway/config/ConfigStringMap.kt | 4 +- .../rose/gateway/config/GatewayConfigFile.kt | 39 +- .../kotlin/com/rose/gateway/config/Item.kt | 5 +- .../com/rose/gateway/config/PluginConfig.kt | 30 +- .../config/access/AboutExtensionEnabled.kt | 4 +- .../gateway/config/access/BotConfiguration.kt | 8 +- .../config/access/ChatExtensionEnabled.kt | 4 +- .../rose/gateway/config/access/IpExtension.kt | 8 +- .../gateway/config/access/ListExtension.kt | 8 +- .../gateway/config/access/MinecraftConfig.kt | 16 +- .../config/access/TpsExtensionEnabled.kt | 4 +- .../config/access/WhitelistExtension.kt | 8 +- .../gateway/config/markers/CommonDecoder.kt | 35 +- .../config/markers/CommonExtensionConfig.kt | 11 +- .../config/markers/FilterConfigItems.kt | 8 +- .../rose/gateway/config/schema/AboutConfig.kt | 9 +- .../rose/gateway/config/schema/BotConfig.kt | 8 +- .../rose/gateway/config/schema/ChatConfig.kt | 10 +- .../rose/gateway/config/schema/IpConfig.kt | 10 +- .../rose/gateway/config/schema/ListConfig.kt | 10 +- .../rose/gateway/config/schema/TpsConfig.kt | 9 +- .../gateway/config/schema/WhitelistConfig.kt | 10 +- .../com/rose/gateway/discord/bot/BotState.kt | 4 +- .../com/rose/gateway/discord/bot/BotStatus.kt | 5 +- .../rose/gateway/discord/bot/DiscordBot.kt | 19 +- .../discord/bot/DiscordBotController.kt | 6 +- .../gateway/discord/bot/client/ClientInfo.kt | 5 +- .../bot/extensions/about/AboutExtension.kt | 5 + .../bot/extensions/chat/ChatExtension.kt | 5 + .../bot/extensions/chat/GameChatEvent.kt | 13 +- .../ChannelMentionTokenProcessor.kt | 4 +- .../processing/DiscordMessageProcessor.kt | 31 +- .../processing/RoleMentionTokenProcessor.kt | 9 +- .../chat/processing/TextTokenProcessor.kt | 4 +- .../chat/processing/UrlTokenProcessor.kt | 4 +- .../processing/UserMentionTokenProcessor.kt | 9 +- .../discord/bot/extensions/ip/IpExtension.kt | 5 + .../bot/extensions/list/ListExtension.kt | 5 + .../bot/extensions/tps/TpsExtension.kt | 5 + .../whitelist/WhitelistExtension.kt | 41 +- .../bot/message/GroupAndPaginateItems.kt | 1 - .../gateway/discord/text/DiscordBoldSafe.kt | 4 +- .../rose/gateway/minecraft/CommandRegistry.kt | 6 - .../gateway/minecraft/chat/ActionListener.kt | 12 +- .../gateway/minecraft/chat/ChatListener.kt | 4 +- .../gateway/minecraft/chat/CommandListener.kt | 4 +- .../minecraft/chat/ConnectionListener.kt | 4 +- .../processing/ConvertToDiscordMessage.kt | 10 +- .../tokens/RoleMentionTokenProcessor.kt | 13 +- .../tokens/RoleQuoteMentionTokenProcessor.kt | 13 +- .../TextChannelMentionTokenProcessor.kt | 17 +- .../processing/tokens/TextTokenProcessor.kt | 8 +- .../processing/tokens/UrlTokenProcessor.kt | 12 +- .../tokens/UserMentionTokenProcessor.kt | 13 +- .../tokens/UserQuoteMentionTokenProcessor.kt | 13 +- .../VoiceChannelMentionTokenProcessor.kt | 17 +- .../processing/tokens/result/MentionResult.kt | 5 +- .../tokens/result/TokenProcessingResult.kt | 10 +- .../gateway/minecraft/color/AsTextColor.kt | 4 +- .../commands/arguments/ConfigArgs.kt | 65 +- .../commands/arguments/ConfigListArgs.kt | 16 +- .../commands/completers/ConfigCompleter.kt | 3 +- .../minecraft/commands/framework/Command.kt | 11 +- .../commands/framework/CommandBuilder.kt | 9 +- .../commands/framework/MinecraftCommand.kt | 5 +- .../commands/framework/MinecraftCommands.kt | 4 +- .../framework/MinecraftCommandsBuilder.kt | 4 +- .../framework/data/context/BukkitContext.kt | 6 +- .../data/context/FrameworkContext.kt | 12 +- .../data/executor/ExecutorArgsPair.kt | 5 + .../commands/framework/runner/ArgParser.kt | 5 +- .../commands/framework/runner/CommandArgs.kt | 7 +- .../commands/framework/runner/ParseResult.kt | 13 +- .../framework/subcommand/SubcommandArgs.kt | 14 +- .../commands/parsers/BooleanParser.kt | 10 +- .../commands/parsers/ConfigItemParser.kt | 10 +- .../minecraft/commands/parsers/IntParser.kt | 12 +- .../minecraft/commands/parsers/ListParser.kt | 15 +- .../commands/parsers/ProcessorParser.kt | 21 +- .../commands/parsers/StringParser.kt | 10 +- .../commands/parsers/TypedConfigItemParser.kt | 15 +- .../minecraft/commands/runners/BotCommands.kt | 6 +- .../commands/runners/ConfigCommands.kt | 12 +- .../runners/ConfigMonitoringRunner.kt | 39 +- .../rose/gateway/minecraft/component/Color.kt | 8 +- .../minecraft/component/DiscordComponent.kt | 10 +- .../rose/gateway/minecraft/component/Item.kt | 12 +- .../gateway/minecraft/logging/LogFormatter.kt | 2 +- .../rose/gateway/minecraft/logging/Logger.kt | 3 +- .../rose/gateway/minecraft/server/Console.kt | 4 +- .../gateway/minecraft/server/Scheduler.kt | 5 +- .../gateway/minecraft/server/ServerInfo.kt | 2 +- .../rose/gateway/minecraft/users/UserCount.kt | 4 +- .../shared/collections/builders/DequeOf.kt | 4 +- .../shared/collections/builders/TrieOf.kt | 4 +- .../gateway/shared/collections/trie/Trie.kt | 24 +- .../rose/gateway/shared/concurrency/RunIf.kt | 10 +- .../com/rose/gateway/shared/error/NotNull.kt | 4 +- .../gateway/shared/koin/InitializeKoin.kt | 3 - .../gateway/shared/parsing/TextProcessor.kt | 11 +- .../gateway/shared/reflection/SimpleName.kt | 5 +- .../resources/default_gateway_config.yaml | 94 +- src/main/resources/plugin.yml | 40 +- 143 files changed, 923 insertions(+), 4270 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/aws.xml delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/checkstyleidea-libs/readme.txt delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/detekt.xml delete mode 100644 .idea/discord.xml delete mode 100644 .idea/encodings.xml rename .idea/{ktor.xml => git_toolbox_blame.xml} (50%) delete mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/ktlint-plugin.xml delete mode 100644 .idea/ktlint.xml delete mode 100644 .idea/modules/Gateway.test.iml delete mode 100644 .idea/modules/GitHub.Gateway.main.iml delete mode 100644 .idea/modules/Projects.GitHub.Gateway.main.iml delete mode 100644 .idea/modules/com.rose.gateway.Gateway.main.iml create mode 100644 .idea/runConfigurations/Gateway__qodanaScan_.xml rename .idea/runConfigurations/{Gateway__runChecks_.xml => Gateway__runLints_.xml} (80%) create mode 100644 gradle/libs.versions.toml create mode 100644 qodana.yaml diff --git a/.editorconfig b/.editorconfig index 54f391eb..33905f72 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,2 +1,12 @@ -[*.{kt,kts}] -max_line_length = 120 +root = true + +[*] +insert_final_newline = true + +[{*.kt,*.kts}] +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL + +# Disable wildcard imports entirely +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = unset diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index e2ee760b..02a7d9f0 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -1,61 +1,61 @@ name: Publish Release on: - push: - branches: - - stable + push: + branches: + - stable - paths: - - '**/gradle.properties' + paths: + - '**/gradle.properties' - workflow_dispatch: + workflow_dispatch: jobs: - publish: - runs-on: ubuntu-latest - - steps: - # https://github.com/marketplace/actions/checkout - - uses: actions/checkout@v4 - - # https://github.com/marketplace/actions/setup-java-jdk - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - - name: Set gradlew execution permission - run: chmod u+x gradlew - - # https://github.com/marketplace/actions/generate-version - - name: Get release version - uses: HardNorth/github-version-generate@v1.3.0 - with: - version-source: file - version-file: gradle.properties - version-file-extraction-pattern: '(?<=version=).+' - - # https://github.com/marketplace/actions/semver-parser - - name: Parse release version - uses: apexskier/github-semver-parse@v1 - id: semver - with: - version: ${{ env.RELEASE_VERSION }} - - # https://github.com/marketplace/actions/gradle-build-action - - name: Build artifacts - uses: gradle/gradle-build-action@v2 - with: - arguments: build - - # https://github.com/marketplace/actions/create-release - - name: Create release - uses: ncipollo/release-action@v1 - with: - name: Gateway ${{ env.RELEASE_VERSION }} - tag: v${{ env.RELEASE_VERSION }} - generateReleaseNotes: true - artifacts: 'build/libs/*.jar' - prerelease: ${{ !!steps.semver.outputs.prerelease }} - token: ${{ secrets.GITHUB_TOKEN }} + publish: + runs-on: ubuntu-latest + + steps: + # https://github.com/marketplace/actions/checkout + - uses: actions/checkout@v4 + + # https://github.com/marketplace/actions/setup-java-jdk + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + + - name: Set gradlew execution permission + run: chmod u+x gradlew + + # https://github.com/marketplace/actions/generate-version + - name: Get release version + uses: HardNorth/github-version-generate@v1.4.0 + with: + version-source: file + version-file: gradle.properties + version-file-extraction-pattern: '(?<=version=).+' + + # https://github.com/marketplace/actions/semver-parser + - name: Parse release version + uses: apexskier/github-semver-parse@v1 + id: semver + with: + version: ${{ env.RELEASE_VERSION }} + + # https://github.com/marketplace/actions/gradle-build-action + - name: Build artifacts + uses: gradle/actions/setup-gradle@v3 + with: + arguments: build + + # https://github.com/marketplace/actions/create-release + - name: Create release + uses: ncipollo/release-action@v1 + with: + name: Gateway ${{ env.RELEASE_VERSION }} + tag: v${{ env.RELEASE_VERSION }} + generateReleaseNotes: true + artifacts: 'build/libs/*.jar' + prerelease: ${{ !!steps.semver.outputs.prerelease }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index 881e1e1f..096c49aa 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -1,66 +1,66 @@ name: Check Pull Request on: - pull_request: - branches: - - stable - - develop + pull_request: + branches: + - stable + - develop - paths: - - '**/*.kt' - - '**/*.kts' + paths: + - '**/*.kt' + - '**/*.kts' jobs: - build: - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest - steps: - # https://github.com/marketplace/actions/checkout - - uses: actions/checkout@v4 + steps: + # https://github.com/marketplace/actions/checkout + - uses: actions/checkout@v4 - # https://github.com/marketplace/actions/setup-java-jdk - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin + # https://github.com/marketplace/actions/setup-java-jdk + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin - - name: Set gradlew execution permission - run: chmod u+x gradlew + - name: Set gradlew execution permission + run: chmod u+x gradlew - # https://github.com/marketplace/actions/gradle-build-action - - name: Build artifacts - uses: gradle/gradle-build-action@v2 - with: - arguments: build --stacktrace + # https://github.com/marketplace/actions/gradle-build-action + - name: Build artifacts + uses: gradle/actions/setup-gradle@v3 + with: + arguments: build --stacktrace - ktlint: - runs-on: ubuntu-latest + ktlint: + runs-on: ubuntu-latest - steps: - # https://github.com/marketplace/actions/checkout - - uses: actions/checkout@v4 + steps: + # https://github.com/marketplace/actions/checkout + - uses: actions/checkout@v4 - # https://github.com/marketplace/actions/run-ktlint-with-reviewdog - - uses: ScaCap/action-ktlint@v1.8.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - ktlint_version: '1.0.1' - reporter: github-pr-review - fail_on_error: true + # https://github.com/marketplace/actions/run-ktlint-with-reviewdog + - uses: ScaCap/action-ktlint@v1.9.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + ktlint_version: '1.3.1' + reporter: github-pr-review + fail_on_error: true - detekt: - runs-on: ubuntu-latest + detekt: + runs-on: ubuntu-latest - steps: - # https://github.com/marketplace/actions/checkout - - uses: actions/checkout@v4 + steps: + # https://github.com/marketplace/actions/checkout + - uses: actions/checkout@v4 - # https://github.com/marketplace/actions/run-detekt-with-reviewdog - - name: Run detekt with reviewdog - uses: alaegin/Detekt-Action@v1.23.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - detekt_config: config/detekt/detekt.yml - detekt_build_upon_default_config: true - reporter: github-pr-review + # https://github.com/marketplace/actions/run-detekt-with-reviewdog + - name: Run detekt with reviewdog + uses: alaegin/Detekt-Action@v1.23.6 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + detekt_config: config/detekt/detekt.yml + detekt_build_upon_default_config: true + reporter: github-pr-review diff --git a/.gitignore b/.gitignore index 7ad9fcc2..6e52f056 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ gradle-app.setting # Paper run run/ + +# Gradle docker cache +.gradleDocker diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e09..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/aws.xml b/.idea/aws.xml deleted file mode 100644 index 8e173182..00000000 --- a/.idea/aws.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 9da0b8ca..00000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/checkstyleidea-libs/readme.txt b/.idea/checkstyleidea-libs/readme.txt deleted file mode 100644 index b4fa42cc..00000000 --- a/.idea/checkstyleidea-libs/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -This folder contains libraries copied from the "Gateway" project. -It is managed by the CheckStyle-IDEA IDE plugin. -Do not modify this folder while the IDE is running. -When the IDE is stopped, you may delete this folder at any time. It will be recreated as needed. -In order to prevent the CheckStyle-IDEA IDE plugin from creating this folder, -uncheck the "Copy libraries from project directory" option in the CheckStyle-IDEA settings dialog. diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index a2157208..00000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123c..00000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e..b86273d9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/detekt.xml b/.idea/detekt.xml deleted file mode 100644 index 31ac8051..00000000 --- a/.idea/detekt.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - true - $PROJECT_DIR$/config/detekt/detekt.yml - - \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml deleted file mode 100644 index d8e95616..00000000 --- a/.idea/discord.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index d079ef83..00000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/ktor.xml b/.idea/git_toolbox_blame.xml similarity index 50% rename from .idea/ktor.xml rename to .idea/git_toolbox_blame.xml index fac1a302..7dc12496 100644 --- a/.idea/ktor.xml +++ b/.idea/git_toolbox_blame.xml @@ -1,6 +1,6 @@ - - \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml index bcb1d9df..02b915b8 100644 --- a/.idea/git_toolbox_prj.xml +++ b/.idea/git_toolbox_prj.xml @@ -6,11 +6,6 @@ -