diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index 464f34f..a13fd7c 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -9,47 +9,11 @@ jobs: detekt_validation: needs: gradle_validation uses: ./.github/workflows/detekt-validation.yml -# tests_validation: -# needs: gradle_validation -# uses: ./.github/workflows/tests-validation.yml - - publish: - name: Build and upload - runs-on: ubuntu-latest - needs: [ gradle_validation, detekt_validation ] - steps: - - name: Checkout Git repo - uses: actions/checkout@v2 - - uses: SebRollen/toml-action@v1.0.2 - id: version - with: - file: 'gradle/libs.versions.toml' - field: 'versions.project-version' - - uses: SebRollen/toml-action@v1.0.2 - id: name - with: - file: 'gradle/libs.versions.toml' - field: 'versions.project-name' - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: 17 - - name: Give gradle permission - run: chmod +x gradlew - - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: shadowJar --stacktrace - - name: Create release - id: create_internal_release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.actions_token }} - with: - files: | - ./jars/${{ steps.name.outputs.value }}-${{ steps.version.outputs.value }}.jar - tag_name: ${{ steps.version.outputs.value }} - name: ${{ steps.name.outputs.value }} - ${{ steps.version.outputs.value }} - draft: false - prerelease: false + tests_validation: + needs: gradle_validation + uses: ./.github/workflows/tests-validation.yml + create_artifact: + needs: [ gradle_validation, detekt_validation, tests_validation ] + uses: ./.github/workflows/create-artifacts.yml + secrets: + ACTIONS_TOKEN: ${{ secrets.ACTIONS_TOKEN }} diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml new file mode 100644 index 0000000..353069e --- /dev/null +++ b/.github/workflows/build-project.yml @@ -0,0 +1,21 @@ +name: "detekt-validation" +on: + workflow_call: +jobs: + build: + name: Build project with gradle + runs-on: ubuntu-latest + steps: + - name: Checkout Git repo + uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 17 + - name: Give gradle permission + run: chmod +x gradlew + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build --stacktrace \ No newline at end of file diff --git a/.github/workflows/check-develop.yml b/.github/workflows/check-develop.yml index a613bba..039cf96 100644 --- a/.github/workflows/check-develop.yml +++ b/.github/workflows/check-develop.yml @@ -14,22 +14,7 @@ jobs: tests_validation: needs: gradle_validation uses: ./.github/workflows/tests-validation.yml - build: name: Build project - runs-on: ubuntu-latest needs: [ gradle_validation, detekt_validation ] - steps: - - name: Checkout Git repo - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: 17 - - name: Give gradle permission - run: chmod +x gradlew - - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: build --stacktrace \ No newline at end of file + uses: ./.github/workflows/build-project.yml \ No newline at end of file diff --git a/.github/workflows/create-artifacts.yml b/.github/workflows/create-artifacts.yml new file mode 100644 index 0000000..8a6ab3e --- /dev/null +++ b/.github/workflows/create-artifacts.yml @@ -0,0 +1,41 @@ +name: "detekt-validation" +on: + workflow_call: + secrets: + ACTIONS_TOKEN: + required: true +jobs: + publish: + name: Build and upload + runs-on: ubuntu-latest + steps: + - name: Checkout Git repo + uses: actions/checkout@v2 + - uses: christian-draeger/read-properties@1.1.1 + id: properties + with: + path: './gradle.properties' + properties: 'makeevrserg.project.name makeevrserg.project.version.string' + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 17 + - name: Give gradle permission + run: chmod +x gradlew + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: shadowJar --stacktrace + - name: Create release + id: create_internal_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} + with: + files: | + ./jars/${{ steps.properties.outputs.makeevrserg-project-name }}-${{ steps.properties.outputs.makeevrserg-project-version-string }}.jar + tag_name: ${{ steps.properties.outputs.makeevrserg-project-version-string }} + name: ${{ steps.properties.outputs.makeevrserg-project-name }} - ${{ steps.properties.outputs.makeevrserg-project-version-string }} + draft: false + prerelease: false diff --git a/.github/workflows/detekt-validation.yml b/.github/workflows/detekt-validation.yml index 6ca1f45..c33181c 100644 --- a/.github/workflows/detekt-validation.yml +++ b/.github/workflows/detekt-validation.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up JDK 1.11 + - name: Set up JDK 1.17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Give gradle permission run: chmod +x gradlew - name: detekt diff --git a/build-logic/.gitignore b/build-logic/.gitignore deleted file mode 100644 index 151fdd4..0000000 --- a/build-logic/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build -.gradle \ No newline at end of file diff --git a/build-logic/plugins/convention/build.gradle.kts b/build-logic/plugins/convention/build.gradle.kts deleted file mode 100644 index 692d388..0000000 --- a/build-logic/plugins/convention/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - java - `maven-publish` - `java-library` - `kotlin-dsl` - alias(libs.plugins.kotlin.jvm) apply false - alias(libs.plugins.kotlin.serialization) apply false - alias(libs.plugins.gradle.shadow) apply false -} -dependencies { - compileOnly(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) - implementation(libs.lint.detekt.gradle) - implementation(libs.kotlin.gradle) - implementation(libs.kotlin.serialization) - implementation(libs.gradle.shadow) -} diff --git a/build-logic/plugins/convention/src/main/kotlin/basic-java.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/basic-java.gradle.kts deleted file mode 100644 index 8756c89..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/basic-java.gradle.kts +++ /dev/null @@ -1,39 +0,0 @@ -plugins { - java - `java-library` - id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.kotlin.plugin.serialization") -} - -group = libs.versions.project.group.get() -version = libs.versions.project.version.get() -description = libs.versions.project.description.get() - -java { - withSourcesJar() - withJavadocJar() - java.sourceCompatibility = JavaVersion.VERSION_1_8 - java.targetCompatibility = JavaVersion.VERSION_17 -} -// TODO -// kotlin { -// jvmToolchain(11) -// } -tasks { - withType() { - options.encoding = "UTF-8" - } - withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.majorVersion - } - compileJava { - options.encoding = "UTF-8" - } - test { - useJUnit() - testLogging { - events("passed", "skipped", "failed") - this.showStandardStreams = true - } - } -} diff --git a/build-logic/plugins/convention/src/main/kotlin/detekt-convention.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/detekt-convention.gradle.kts deleted file mode 100644 index 49aa955..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/detekt-convention.gradle.kts +++ /dev/null @@ -1,41 +0,0 @@ -import io.gitlab.arturbosch.detekt.Detekt - -plugins { - id("io.gitlab.arturbosch.detekt") -} - -tasks.register("detektFormat") { - autoCorrect = true -} - -tasks.withType { - // Disable caching - outputs.upToDateWhen { false } - - reports { - html.required.set(true) - xml.required.set(false) - txt.required.set(false) - } - - setSource(files(projectDir)) - config.setFrom(files("$rootDir/gradle/detekt.yml")) - - include("**/*.kt", "**/*.kts") - exclude( - "**/resources/**", - "**/build/**", - ) - - parallel = true - - buildUponDefaultConfig = true - - // Target version of the generated JVM bytecode. It is used for type resolution. - this.jvmTarget = "1.8" -} - -dependencies { - detektPlugins(libs.lint.detekt.ruleset.compiler) - detektPlugins(libs.lint.detekt.ruleset.ktlint) -} diff --git a/build-logic/plugins/convention/src/main/kotlin/ru/astrainteractive/buildlogic/PublishPrimaryVersionTask.kt b/build-logic/plugins/convention/src/main/kotlin/ru/astrainteractive/buildlogic/PublishPrimaryVersionTask.kt deleted file mode 100644 index e69292d..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/ru/astrainteractive/buildlogic/PublishPrimaryVersionTask.kt +++ /dev/null @@ -1,27 +0,0 @@ -package ru.astrainteractive.buildlogic - -import libs -import org.gradle.api.Task -import java.io.File - -class PublishPrimaryVersionTask(private val task: Task) { - operator fun invoke() { - val libs = task.project.libs - val rootDir = task.project.rootDir - - val file = File(File(rootDir, ".github"), "version.env") - if (!file.exists()) { - file.parentFile.mkdirs() - file.createNewFile() - } - file.writeText("") - mapOf( - "MAJOR_VERSION" to libs.versions.project.version.get(), - "PROJECT_NAME" to libs.versions.project.name.get() - ).forEach { - file.appendText( - "${it.key}=${it.value}\n" - ) - } - } -} diff --git a/build-logic/plugins/convention/src/main/kotlin/spigot-resource-processor.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/spigot-resource-processor.gradle.kts deleted file mode 100644 index dd4bde4..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/spigot-resource-processor.gradle.kts +++ /dev/null @@ -1,36 +0,0 @@ -import org.gradle.api.file.DuplicatesStrategy - -plugins { - java - `java-library` - id("org.jetbrains.kotlin.jvm") -} - -tasks.processResources { - filteringCharset = "UTF-8" - from(sourceSets.main.get().resources.srcDirs) { - // It is available to declare dependencies like this - val implementations: List = listOf( - libs.kotlin.coroutines.core, - libs.kotlin.coroutines.coreJvm, - libs.kotlin.serialization, - libs.kotlin.serializationJson, - libs.kotlin.serializationKaml, - libs.kotlin.gradle, - ).map { it.get().toString() } - filesMatching("plugin.yml") { - expand( - "main" to "${libs.versions.project.group.get()}.${libs.versions.project.name.get()}", - "name" to libs.versions.project.name.get(), - "prefix" to libs.versions.project.name.get(), - "version" to libs.versions.project.version.get(), - "description" to libs.versions.project.description.get(), - "url" to libs.versions.project.url.get(), - "author" to libs.versions.project.author.get(), - "authors" to libs.versions.project.authors.get().split(";").joinToString("\",\""), - "libraries" to implementations.joinToString("\",\""), - ) - } - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } -} diff --git a/build-logic/plugins/convention/src/main/kotlin/spigot-shadow.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/spigot-shadow.gradle.kts deleted file mode 100644 index 738b74c..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/spigot-shadow.gradle.kts +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - java - `java-library` - id("org.jetbrains.kotlin.jvm") - id("com.github.johnrengelman.shadow") -} - -tasks.shadowJar { - dependsOn(tasks.processResources) - - isReproducibleFileOrder = true - mergeServiceFiles() - relocate("org.bstats", libs.versions.project.group.get()) - listOf( - "kotlin", - "org.jetbrains", - libs.minecraft.astralibs.ktxcore.get().module.group - ).forEach { - relocate(it, libs.versions.project.group.get() + ".$it") - } - dependsOn(configurations) - archiveClassifier.set(null as String?) - from(sourceSets.main.get().output) - from(project.configurations.runtimeClasspath) - minimize() - archiveBaseName.set(libs.versions.project.name.get()) - File(libs.versions.destination.paper.get()).let { - if (!it.exists()) { - File(rootDir, "jars").also(File::mkdirs) - } else { - it - } - }.also(destinationDirectory::set) -} diff --git a/build-logic/plugins/convention/src/main/kotlin/versionCatalog.kt b/build-logic/plugins/convention/src/main/kotlin/versionCatalog.kt deleted file mode 100644 index 8f6e89b..0000000 --- a/build-logic/plugins/convention/src/main/kotlin/versionCatalog.kt +++ /dev/null @@ -1,6 +0,0 @@ -import org.gradle.accessors.dm.LibrariesForLibs -import org.gradle.api.Project -import org.gradle.kotlin.dsl.the - -val Project.libs: LibrariesForLibs - get() = the() diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts deleted file mode 100644 index 95271dd..0000000 --- a/build-logic/settings.gradle.kts +++ /dev/null @@ -1,41 +0,0 @@ -enableFeaturePreview("STABLE_CONFIGURATION_CACHE") -enableFeaturePreview("VERSION_CATALOGS") - -pluginManagement { - repositories { - maven("https://files.minecraftforge.net/maven") - maven("https://dist.creeper.host/Sponge/maven") - maven("https://plugins.gradle.org/m2/") - maven("https://jitpack.io") - gradlePluginPortal() - mavenCentral() - mavenLocal() - google() - } -} -dependencyResolutionManagement { - repositories { - gradlePluginPortal() - mavenLocal() - mavenCentral() - maven("https://mvn.lumine.io/repository/maven-public/") { metadataSources { artifact() } } - maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") - maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") - maven("https://papermc.io/repo/repository/maven-public/") - maven("https://nexus.scarsz.me/content/groups/public/") - maven("https://repo.dmulloy2.net/repository/public/") - maven("https://repo.essentialsx.net/snapshots/") - maven("https://repo.maven.apache.org/maven2/") - maven("https://maven.enginehub.org/repo/") - maven("https://m2.dv8tion.net/releases") - maven("https://repo1.maven.org/maven2/") - maven("https://maven.playpro.com") - maven("https://jitpack.io") - } - versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } } -} -rootProject.name = "build-logic" - -include( - ":plugins:convention" -) diff --git a/build.gradle.kts b/build.gradle.kts index 409bb06..5b4d01c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,24 @@ -group = libs.versions.project.group.get() -version = libs.versions.project.version.get() -description = libs.versions.project.description.get() +buildscript { + dependencies { + classpath("ru.astrainteractive.gradleplugin:convention:0.0.10") + classpath("ru.astrainteractive.gradleplugin:minecraft:0.0.10") + } +} plugins { java `java-library` alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.kotlin.serialization) apply false - alias(libs.plugins.gradle.shadow) apply false - id("detekt-convention") +} + +apply(plugin = "ru.astrainteractive.gradleplugin.dokka.root") +apply(plugin = "ru.astrainteractive.gradleplugin.detekt") +apply(plugin = "ru.astrainteractive.gradleplugin.root.info") + +subprojects.forEach { + it.apply(plugin = "ru.astrainteractive.gradleplugin.dokka.module") + it.plugins.withId("org.jetbrains.kotlin.jvm") { + it.apply(plugin = "ru.astrainteractive.gradleplugin.java.core") + } } diff --git a/domain/core/build.gradle.kts b/domain/core/build.gradle.kts index 15cf99f..a7d2c02 100644 --- a/domain/core/build.gradle.kts +++ b/domain/core/build.gradle.kts @@ -1,7 +1,6 @@ plugins { kotlin("jvm") kotlin("plugin.serialization") - id("basic-java") } dependencies { // Kotlin diff --git a/domain/spigot/build.gradle.kts b/domain/spigot/build.gradle.kts index 7f41f79..8257fe7 100644 --- a/domain/spigot/build.gradle.kts +++ b/domain/spigot/build.gradle.kts @@ -1,7 +1,6 @@ plugins { kotlin("jvm") kotlin("plugin.serialization") - id("basic-java") } dependencies { // Kotlin diff --git a/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/alias.kt b/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/alias.kt index 4c4366f..fe0185d 100644 --- a/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/alias.kt +++ b/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/alias.kt @@ -1,3 +1,5 @@ +@file:Suppress("Filename") + package ru.astrainteractive.astrashop.domain.utils import ru.astrainteractive.astrashop.domain.models.ShopConfig diff --git a/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/ext_domain.kt b/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/ext_domain.kt index c78aa2e..f1a9d03 100644 --- a/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/ext_domain.kt +++ b/domain/spigot/src/main/kotlin/ru/astrainteractive/astrashop/domain/utils/ext_domain.kt @@ -1,3 +1,5 @@ +@file:Suppress("Filename") + package ru.astrainteractive.astrashop.domain.utils import org.bukkit.configuration.ConfigurationSection diff --git a/gradle.properties b/gradle.properties index 7fc6f1f..13137a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,13 @@ kotlin.code.style=official +# Java +makeevrserg.java.source=8 +makeevrserg.java.target=17 +makeevrserg.java.ktarget=17 +# Project +makeevrserg.project.name=AstraShop +makeevrserg.project.group=ru.astrainteractive.astrashop +makeevrserg.project.version.string=3.1.4 +makeevrserg.project.description=Shop plugin for EmpireSMP +makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com +makeevrserg.project.url=https://empireprojekt.ru +makeevrserg.publish.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com \ No newline at end of file diff --git a/gradle/detekt.yml b/gradle/detekt.yml deleted file mode 100644 index d613c6e..0000000 --- a/gradle/detekt.yml +++ /dev/null @@ -1,732 +0,0 @@ -build: - maxIssues: 0 - excludeCorrectable: false - weights: - # complexity: 2 - # LongParameterList: 1 - # style: 1 - # comments: 1 - -config: - validation: true - warningsAsErrors: false - checkExhaustiveness: false - # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' - excludes: '' - -processors: - active: true - exclude: - - 'DetektProgressListener' - # - 'KtFileCountProcessor' - # - 'PackageCountProcessor' - # - 'ClassCountProcessor' - # - 'FunctionCountProcessor' - # - 'PropertyCountProcessor' - # - 'ProjectComplexityProcessor' - # - 'ProjectCognitiveComplexityProcessor' - # - 'ProjectLLOCProcessor' - # - 'ProjectCLOCProcessor' - # - 'ProjectLOCProcessor' - # - 'ProjectSLOCProcessor' - # - 'LicenseHeaderLoaderExtension' - -console-reports: - active: true - exclude: - - 'ProjectStatisticsReport' - - 'ComplexityReport' - - 'NotificationReport' - - 'FindingsReport' - - 'FileBasedFindingsReport' - # - 'LiteFindingsReport' - -output-reports: - active: true - exclude: - # - 'TxtOutputReport' - # - 'XmlOutputReport' - # - 'HtmlOutputReport' - # - 'MdOutputReport' - -comments: - active: true - AbsentOrWrongFileLicense: - active: false - licenseTemplateFile: 'license.template' - licenseTemplateIsRegex: false - CommentOverPrivateFunction: - active: false - CommentOverPrivateProperty: - active: false - DeprecatedBlockTag: - active: false - EndOfSentenceFormat: - active: false - endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' - KDocReferencesNonPublicProperty: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - OutdatedDocumentation: - active: false - matchTypeParameters: true - matchDeclarationsOrder: true - allowParamOnConstructorProperties: false - UndocumentedPublicClass: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - searchInNestedClass: true - searchInInnerClass: true - searchInInnerObject: true - searchInInnerInterface: true - searchInProtectedClass: false - UndocumentedPublicFunction: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - searchProtectedFunction: false - UndocumentedPublicProperty: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - searchProtectedProperty: false - -complexity: - active: true - CognitiveComplexMethod: - active: false - threshold: 15 - ComplexCondition: - active: true - threshold: 4 - ComplexInterface: - active: false - threshold: 10 - includeStaticDeclarations: false - includePrivateDeclarations: false - ignoreOverloaded: false - CyclomaticComplexMethod: - active: true - threshold: 15 - ignoreSingleWhenExpression: false - ignoreSimpleWhenEntries: false - ignoreNestingFunctions: false - nestingFunctions: - - 'also' - - 'apply' - - 'forEach' - - 'isNotNull' - - 'ifNull' - - 'let' - - 'run' - - 'use' - - 'with' - LabeledExpression: - active: false - ignoredLabels: [ ] - LargeClass: - active: true - threshold: 600 - LongMethod: - active: true - threshold: 60 - LongParameterList: - active: true - functionThreshold: 6 - constructorThreshold: 7 - ignoreDefaultParameters: false - ignoreDataClasses: true - ignoreAnnotatedParameter: [ ] - ignoreAnnotated: [ 'Composable' ] - MethodOverloading: - active: false - threshold: 6 - NamedArguments: - active: false - threshold: 3 - ignoreArgumentsMatchingNames: false - NestedBlockDepth: - active: true - threshold: 4 - NestedScopeFunctions: - active: false - threshold: 1 - functions: - - 'kotlin.apply' - - 'kotlin.run' - - 'kotlin.with' - - 'kotlin.let' - - 'kotlin.also' - ReplaceSafeCallChainWithRun: - active: false - StringLiteralDuplication: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - threshold: 3 - ignoreAnnotation: true - excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' - TooManyFunctions: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - thresholdInFiles: 11 - thresholdInClasses: 11 - thresholdInInterfaces: 11 - thresholdInObjects: 11 - thresholdInEnums: 11 - ignoreDeprecated: false - ignorePrivate: false - ignoreOverridden: false - -coroutines: - active: true - GlobalCoroutineUsage: - active: false - InjectDispatcher: - active: true - dispatcherNames: - - 'IO' - - 'Default' - - 'Unconfined' - RedundantSuspendModifier: - active: true - SleepInsteadOfDelay: - active: true - SuspendFunWithCoroutineScopeReceiver: - active: false - SuspendFunWithFlowReturnType: - active: true - -empty-blocks: - active: true - EmptyCatchBlock: - active: true - allowedExceptionNameRegex: '_|(ignore|expected).*' - EmptyClassBlock: - active: true - EmptyDefaultConstructor: - active: true - EmptyDoWhileBlock: - active: true - EmptyElseBlock: - active: true - EmptyFinallyBlock: - active: true - EmptyForBlock: - active: true - EmptyFunctionBlock: - active: true - ignoreOverridden: false - EmptyIfBlock: - active: true - EmptyInitBlock: - active: true - EmptyKtFile: - active: true - EmptySecondaryConstructor: - active: true - EmptyTryBlock: - active: true - EmptyWhenBlock: - active: true - EmptyWhileBlock: - active: true - -exceptions: - active: true - ExceptionRaisedInUnexpectedLocation: - active: true - methodNames: - - 'equals' - - 'finalize' - - 'hashCode' - - 'toString' - InstanceOfCheckForException: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - NotImplementedDeclaration: - active: false - ObjectExtendsThrowable: - active: false - PrintStackTrace: - active: true - RethrowCaughtException: - active: true - ReturnFromFinally: - active: true - ignoreLabeled: false - SwallowedException: - active: true - ignoredExceptionTypes: - - 'InterruptedException' - - 'MalformedURLException' - - 'NumberFormatException' - - 'ParseException' - allowedExceptionNameRegex: '_|(ignore|expected).*' - ThrowingExceptionFromFinally: - active: true - ThrowingExceptionInMain: - active: false - ThrowingExceptionsWithoutMessageOrCause: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - exceptions: - - 'ArrayIndexOutOfBoundsException' - - 'Exception' - - 'IllegalArgumentException' - - 'IllegalMonitorStateException' - - 'IllegalStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - ThrowingNewInstanceOfSameException: - active: true - TooGenericExceptionCaught: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - exceptionNames: - - 'ArrayIndexOutOfBoundsException' - - 'Error' - - 'Exception' - - 'IllegalMonitorStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - allowedExceptionNameRegex: '_|(ignore|expected).*' - TooGenericExceptionThrown: - active: true - exceptionNames: - - 'Error' - - 'Exception' - - 'RuntimeException' - - 'Throwable' - -naming: - active: true - BooleanPropertyNaming: - active: false - allowedPattern: '^(is|has|are)' - ignoreOverridden: true - ClassNaming: - active: true - classPattern: '[A-Z][a-zA-Z0-9]*' - excludes: - - 'versionCatalog' - - 'modules' - ConstructorParameterNaming: - active: true - parameterPattern: '[a-z][A-Za-z0-9]*' - privateParameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - EnumNaming: - active: true - enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' - ForbiddenClassName: - active: false - forbiddenName: [ ] - FunctionMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionMinLength: - active: false - minimumFunctionNameLength: 3 - FunctionNaming: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - functionPattern: '[a-z][a-zA-Z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - ignoreAnnotated: [ 'Composable' ] - FunctionParameterNaming: - active: true - parameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - InvalidPackageDeclaration: - active: true - rootPackage: '' - requireRootInDeclaration: false - LambdaParameterNaming: - active: false - parameterPattern: '[a-z][A-Za-z0-9]*|_' - MatchingDeclarationName: - active: true - mustBeFirst: true - MemberNameEqualsClassName: - active: true - ignoreOverridden: true - NoNameShadowing: - active: true - NonBooleanPropertyPrefixedWithIs: - active: false - ObjectPropertyNaming: - active: true - constantPattern: '[A-Za-z][_A-Za-z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' - PackageNaming: - active: true - packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' - TopLevelPropertyNaming: - active: true - constantPattern: '[A-Z][_A-Z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' - VariableMaxLength: - active: false - maximumVariableNameLength: 64 - VariableMinLength: - active: false - minimumVariableNameLength: 1 - VariableNaming: - active: true - variablePattern: '[a-z][A-Za-z0-9]*' - privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - -performance: - active: true - ArrayPrimitive: - active: true - CouldBeSequence: - active: false - threshold: 3 - ForEachOnRange: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - SpreadOperator: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - UnnecessaryPartOfBinaryExpression: - active: false - UnnecessaryTemporaryInstantiation: - active: true - -potential-bugs: - active: true - AvoidReferentialEquality: - active: true - forbiddenTypePatterns: - - 'kotlin.String' - CastToNullableType: - active: false - Deprecation: - active: false - DontDowncastCollectionTypes: - active: false - DoubleMutabilityForCollection: - active: true - mutableTypes: - - 'kotlin.collections.MutableList' - - 'kotlin.collections.MutableMap' - - 'kotlin.collections.MutableSet' - - 'java.util.ArrayList' - - 'java.util.LinkedHashSet' - - 'java.util.HashSet' - - 'java.util.LinkedHashMap' - - 'java.util.HashMap' - ElseCaseInsteadOfExhaustiveWhen: - active: false - EqualsAlwaysReturnsTrueOrFalse: - active: true - EqualsWithHashCodeExist: - active: true - ExitOutsideMain: - active: false - ExplicitGarbageCollectionCall: - active: true - HasPlatformType: - active: true - IgnoredReturnValue: - active: true - restrictToConfig: true - returnValueAnnotations: - - '*.CheckResult' - - '*.CheckReturnValue' - ignoreReturnValueAnnotations: - - '*.CanIgnoreReturnValue' - returnValueTypes: - - 'kotlin.sequences.Sequence' - - 'kotlinx.coroutines.flow.*Flow' - - 'java.util.stream.*Stream' - ignoreFunctionCall: [ ] - ImplicitDefaultLocale: - active: true - ImplicitUnitReturnType: - active: false - allowExplicitReturnType: true - InvalidRange: - active: true - IteratorHasNextCallsNextMethod: - active: true - IteratorNotThrowingNoSuchElementException: - active: true - LateinitUsage: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - ignoreOnClassesPattern: '' - MapGetWithNotNullAssertionOperator: - active: true - MissingPackageDeclaration: - active: false - excludes: [ '**/*.kts' ] - NullCheckOnMutableProperty: - active: false - NullableToStringCall: - active: false - UnconditionalJumpStatementInLoop: - active: false - UnnecessaryNotNullCheck: - active: false - UnnecessaryNotNullOperator: - active: true - UnnecessarySafeCall: - active: true - UnreachableCatchBlock: - active: true - UnreachableCode: - active: true - UnsafeCallOnNullableType: - active: true - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] - UnsafeCast: - active: true - UnusedUnaryOperator: - active: true - UselessPostfixExpression: - active: true - WrongEqualsTypeParameter: - active: true - -style: - active: true - AlsoCouldBeApply: - active: false - CanBeNonNullable: - active: false - CascadingCallWrapping: - active: false - includeElvis: true - ClassOrdering: - active: false - CollapsibleIfStatements: - active: false - DataClassContainsFunctions: - active: false - conversionFunctionPrefix: - - 'to' - DataClassShouldBeImmutable: - active: false - DestructuringDeclarationWithTooManyEntries: - active: true - maxDestructuringEntries: 3 - EqualsNullCall: - active: true - EqualsOnSignatureLine: - active: false - ExplicitCollectionElementAccessMethod: - active: false - ExplicitItLambdaParameter: - active: true - ExpressionBodySyntax: - active: false - includeLineWrapping: false - ForbiddenComment: - active: true - values: - - 'FIXME:' - - 'STOPSHIP:' - - 'TODO:' - allowedPatterns: '' - customMessage: '' - ForbiddenImport: - active: false - imports: [ ] - forbiddenPatterns: '' - ForbiddenMethodCall: - active: false - methods: - - reason: 'print does not allow you to configure the output stream. Use a logger instead.' - value: 'kotlin.io.print' - - reason: 'println does not allow you to configure the output stream. Use a logger instead.' - value: 'kotlin.io.println' - ForbiddenSuppress: - active: false - rules: [ ] - ForbiddenVoid: - active: true - ignoreOverridden: false - ignoreUsageInGenerics: false - FunctionOnlyReturningConstant: - active: true - ignoreOverridableFunction: true - ignoreActualFunction: true - excludedFunctions: [ ] - LoopWithTooManyJumpStatements: - active: true - maxJumpCount: 1 - MagicNumber: - active: false - excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts' ] - ignoreNumbers: - - '-1' - - '0' - - '1' - - '2' - ignoreHashCodeFunction: true - ignorePropertyDeclaration: false - ignoreLocalVariableDeclaration: false - ignoreConstantDeclaration: true - ignoreCompanionObjectPropertyDeclaration: true - ignoreAnnotation: false - ignoreNamedArgument: true - ignoreEnums: false - ignoreRanges: false - ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false - MandatoryBracesLoops: - active: false - MaxChainedCallsOnSameLine: - active: false - maxChainedCalls: 5 - MaxLineLength: - active: true - maxLineLength: 120 - excludePackageStatements: true - excludeImportStatements: true - excludeCommentStatements: false - excludeRawStrings: true - MayBeConst: - active: true - ModifierOrder: - active: true - MultilineLambdaItParameter: - active: false - MultilineRawStringIndentation: - active: false - indentSize: 4 - NestedClassesVisibility: - active: true - NewLineAtEndOfFile: - active: true - NoTabs: - active: false - NullableBooleanCheck: - active: false - ObjectLiteralToLambda: - active: true - OptionalAbstractKeyword: - active: true - OptionalUnit: - active: false - OptionalWhenBraces: - active: false - PreferToOverPairSyntax: - active: false - ProtectedMemberInFinalClass: - active: true - RedundantExplicitType: - active: false - RedundantHigherOrderMapUsage: - active: true - RedundantVisibilityModifierRule: - active: false - ReturnCount: - active: false - max: 2 - excludedFunctions: - - 'equals' - excludeLabeled: false - excludeReturnFromLambda: true - excludeGuardClauses: false - SafeCast: - active: true - SerialVersionUIDInSerializableClass: - active: true - SpacingBetweenPackageAndImports: - active: false - ThrowsCount: - active: true - max: 2 - excludeGuardClauses: false - TrailingWhitespace: - active: false - TrimMultilineRawString: - active: false - UnderscoresInNumericLiterals: - active: false - acceptableLength: 4 - allowNonStandardGrouping: false - UnnecessaryAbstractClass: - active: false - UnnecessaryAnnotationUseSiteTarget: - active: false - UnnecessaryApply: - active: true - UnnecessaryBackticks: - active: false - UnnecessaryFilter: - active: true - UnnecessaryInheritance: - active: true - UnnecessaryInnerClass: - active: false - UnnecessaryLet: - active: false - UnnecessaryParentheses: - active: false - allowForUnclearPrecedence: false - UntilInsteadOfRangeTo: - active: false - UnusedImports: - active: false - UnusedPrivateClass: - active: true - UnusedPrivateMember: - active: true - allowedNames: '(_|event|ignored|expected|serialVersionUID|Composable.*Preview)' - ignoreAnnotated: [ 'Composable', 'Inject' ] - UseAnyOrNoneInsteadOfFind: - active: true - UseArrayLiteralsInAnnotations: - active: true - UseCheckNotNull: - active: true - UseCheckOrError: - active: true - UseDataClass: - active: false - allowVars: false - UseEmptyCounterpart: - active: false - UseIfEmptyOrIfBlank: - active: false - UseIfInsteadOfWhen: - active: false - UseIsNullOrEmpty: - active: true - UseOrEmpty: - active: true - UseRequire: - active: true - UseRequireNotNull: - active: true - UseSumOfInsteadOfFlatMapSize: - active: false - UselessCallOnNotNull: - active: true - UtilityClassWithPublicConstructor: - active: true - VarCouldBeVal: - active: true - ignoreLateinitVar: false - WildcardImport: - active: true - excludeImports: - - 'java.util.*' -formatting: - Filename: - active: false \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ba83885..618c0d5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,21 +1,6 @@ [versions] -# Plugin core -project-version = "3.1.3" -project-name = "AstraShop" -project-group = "ru.astrainteractive.astrashop" -project-url = "EmpireProjekt.ru" -project-description = "Shop plugin for EmpireSMP" -project-authors = "Roman Makeev" -project-author = "Roman Makeev" - -# Plugin destinations -destination-paper = "D:\\Minecraft Servers\\Servers\\esmp-configuration\\smp\\plugins" -destination-fabric = "C:\\Users\\Roman\\Desktop\\server\\mods" -destination-forge = "C:\\Users\\Roman\\Desktop\\Forge\\mods" -destination-velocity = "D:\\Minecraft Servers\\Servers\\esmp-configuration\\velocity\\plugins" - # Kotlin -kotlin-version = "1.8.10" +kotlin-version = "1.9.0" kotlin-coroutines = "1.6.3" kotlin-json = "1.5.0-RC" kotlin-kaml = "0.50.0" @@ -24,18 +9,16 @@ kotlin-kaml = "0.50.0" driver-jdbc = "3.36.0.3" driver-mysql = "8.0.20" - - # Minecraft minecraft-version = "1.19.2" minecraft-velocity = "3.1.1" -minecraft-spigot = "1.19.3-R0.1-SNAPSHOT" +minecraft-spigot = "1.20.1-R0.1-SNAPSHOT" minecraft-papi = "2.11.2" minecraft-protocollib = "4.8.0" minecraft-wg = "7.0.7" minecraft-vault = "1.7" minecraft-coreprotect = "21.2" -minecraft-astralibs = "2.7.4" +minecraft-astralibs = "2.7.5" minecraft-bstats = "3.0.0" minecraft-mockbukkit = "v1.19-SNAPSHOT" @@ -56,11 +39,6 @@ minecraft-fabric-api = "0.60.0+1.19.2" minecraft-forge-net = "5.1.61" minecrft-forge-version = "1.19.2-43.1.52" -# Linter -lint-detekt = "1.22.0" -lint-detekt-ruleset-compiler = "0.0.2" -lint-detekt-ruleset-ktlint = "0.48.0" - # Shadow gradle-shadow = "7.1.2" @@ -71,19 +49,12 @@ gradle-buildconfig = "3.1.0" exposed = "0.38.1" [libraries] -# Linter -lint-detekt-gradle = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "lint-detekt" } -lint-detekt-ruleset-compiler = { module = "com.braisgabin.detekt:kotlin-compiler-wrapper", version.ref = "lint-detekt-ruleset-compiler" } -lint-detekt-ruleset-ktlint = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "lint-detekt" } - # Kotlin kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" } kotlin-coroutines-coreJvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "kotlin-coroutines" } kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin-version" } kotlin-serializationJson = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-json" } kotlin-serializationKaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kotlin-kaml" } -kotlin-dokka-kotlinJavaPlugin = { module = "org.jetbrains.dokka:kotlin-as-java-plugin", version.ref = "kotlin-version" } -kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlin-version" } kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-version" } # Shadow @@ -102,7 +73,6 @@ exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "e exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" } exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" } - # Minecraft minecraft-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "minecraft-spigot" } minecraft-spigot-api = { module = "org.spigotmc:spigot-api", version.ref = "minecraft-spigot" } @@ -131,8 +101,7 @@ minecraft-mojang = { module = "com.mojang:minecraft", version.ref = "minecraft-v exposed = ["exposed-java-time", "exposed-jdbc", "exposed-dao", "exposed-core"] minecraft-bukkit = ["minecraft-paper-api", "minecraft-spigot-api", "minecraft-spigot-core", "minecraft-vaultapi", "minecraft-papi"] testing-kotlin = ["kotlin-coroutines-core", "kotlin-coroutines-coreJvm", "driver-jdbc", "driver-mysql", "kotlin-serialization", "kotlin-serializationJson"] -kotlin = ["kotlin-coroutines-core", "kotlin-coroutines-coreJvm", "kotlin-serialization", "kotlin-serializationJson", "kotlin-serializationKaml", "kotlin-dokka-kotlinJavaPlugin", "kotlin-gradle"] - +kotlin = ["kotlin-coroutines-core", "kotlin-coroutines-coreJvm", "kotlin-serialization", "kotlin-serializationJson", "kotlin-serializationKaml", "kotlin-gradle"] [plugins] # Kotlin @@ -144,9 +113,6 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi minecraft-fabric-loom = { id = "fabric-loom", version.ref = "minecraft-fabric-loom" } minecraft-forge-net = { id = "net.minecraftforge.gradle", version.ref = "minecraft-forge-net" } -# Lint -lint-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "lint-detekt" } - # Gradle gradle-shadow = { id = "com.github.johnrengelman.shadow", version.ref = "gradle-shadow" } gradle-buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "gradle-buildconfig" } \ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 3b7a84a..5e1c074 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,9 +1,9 @@ +import ru.astrainteractive.gradleplugin.setupSpigotProcessor +import ru.astrainteractive.gradleplugin.setupSpigotShadow + plugins { kotlin("jvm") kotlin("plugin.serialization") - id("basic-java") - id("spigot-shadow") - id("spigot-resource-processor") } dependencies { @@ -28,3 +28,6 @@ dependencies { implementation(projects.domain.core) implementation(projects.domain.spigot) } + +setupSpigotShadow() +setupSpigotProcessor() diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/AstraShop.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/AstraShop.kt index fadb484..90aa172 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/AstraShop.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/AstraShop.kt @@ -9,9 +9,9 @@ import org.jetbrains.kotlin.tooling.core.UnsafeApi import ru.astrainteractive.astralibs.async.PluginScope import ru.astrainteractive.astralibs.getValue import ru.astrainteractive.astralibs.menu.event.GlobalInventoryClickEvent -import ru.astrainteractive.astrashop.commands.CommandManager +import ru.astrainteractive.astrashop.command.CommandManager import ru.astrainteractive.astrashop.di.RootModule -import ru.astrainteractive.astrashop.di.impl.CommandsModuleImpl +import ru.astrainteractive.astrashop.di.impl.CommandModuleImpl import ru.astrainteractive.astrashop.di.impl.RootModuleImpl /** @@ -27,7 +27,7 @@ class AstraShop : JavaPlugin() { * This method called when server starts or PlugMan load plugin. */ override fun onEnable() { - CommandManager(this, CommandsModuleImpl).build() + CommandManager(this, CommandModuleImpl).build() GlobalInventoryClickEvent.onEnable(this) } diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/CommandManager.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/CommandManager.kt similarity index 64% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/CommandManager.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/CommandManager.kt index 8db326e..e5d0a3a 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/CommandManager.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/CommandManager.kt @@ -1,12 +1,12 @@ -package ru.astrainteractive.astrashop.commands +package ru.astrainteractive.astrashop.command import ru.astrainteractive.astralibs.Factory import ru.astrainteractive.astrashop.AstraShop -import ru.astrainteractive.astrashop.commands.di.CommandsModule +import ru.astrainteractive.astrashop.command.di.CommandModule class CommandManager( private val plugin: AstraShop, - private val module: CommandsModule + private val module: CommandModule ) : Factory { override fun build() { diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Reload.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Reload.kt similarity index 78% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Reload.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Reload.kt index 4457f96..5a26476 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Reload.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Reload.kt @@ -1,10 +1,10 @@ -package ru.astrainteractive.astrashop.commands +package ru.astrainteractive.astrashop.command import ru.astrainteractive.astralibs.commands.registerCommand import ru.astrainteractive.astralibs.getValue import ru.astrainteractive.astrashop.AstraShop -import ru.astrainteractive.astrashop.commands.di.CommandsModule -import ru.astrainteractive.astrashop.utils.PluginPermission +import ru.astrainteractive.astrashop.command.di.CommandModule +import ru.astrainteractive.astrashop.util.PluginPermission /** * Reload command handler @@ -17,7 +17,7 @@ import ru.astrainteractive.astrashop.utils.PluginPermission */ internal fun CommandManager.reload( plugin: AstraShop, - module: CommandsModule + module: CommandModule ) = plugin.registerCommand("atempreload") { val translation by module.translation if (!PluginPermission.Reload.hasPermission(sender)) { diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Shop.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Shop.kt similarity index 87% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Shop.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Shop.kt index add9baa..d8ffdd4 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/Shop.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/Shop.kt @@ -1,20 +1,20 @@ -package ru.astrainteractive.astrashop.commands +package ru.astrainteractive.astrashop.command import kotlinx.coroutines.launch import org.bukkit.entity.Player import ru.astrainteractive.astralibs.commands.registerCommand import ru.astrainteractive.astralibs.getValue import ru.astrainteractive.astrashop.AstraShop -import ru.astrainteractive.astrashop.commands.di.CommandsModule +import ru.astrainteractive.astrashop.command.di.CommandModule import ru.astrainteractive.astrashop.gui.ShopPlayerHolder import ru.astrainteractive.astrashop.gui.quicksell.QuickSellGUI import ru.astrainteractive.astrashop.gui.shops.ShopsGUI -import ru.astrainteractive.astrashop.utils.PluginPermission -import ru.astrainteractive.astrashop.utils.openOnMainThread +import ru.astrainteractive.astrashop.util.PluginPermission +import ru.astrainteractive.astrashop.util.openOnMainThread internal fun CommandManager.shop( plugin: AstraShop, - module: CommandsModule + module: CommandModule ) = plugin.registerCommand("ashop") { val translation by module.translation val scope by module.scope diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/di/CommandsModule.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/di/CommandModule.kt similarity index 69% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/di/CommandsModule.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/di/CommandModule.kt index 185ee44..acecec7 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/commands/di/CommandsModule.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/command/di/CommandModule.kt @@ -1,11 +1,11 @@ -package ru.astrainteractive.astrashop.commands.di +package ru.astrainteractive.astrashop.command.di import ru.astrainteractive.astralibs.Dependency import ru.astrainteractive.astralibs.async.AsyncComponent import ru.astrainteractive.astralibs.async.BukkitDispatchers -import ru.astrainteractive.astrashop.utils.PluginTranslation +import ru.astrainteractive.astrashop.util.PluginTranslation -interface CommandsModule { +interface CommandModule { val translation: Dependency val scope: Dependency val dispatchers: Dependency diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/RootModule.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/RootModule.kt index 2f6bc4e..ea77fb4 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/RootModule.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/RootModule.kt @@ -10,7 +10,7 @@ import ru.astrainteractive.astralibs.economy.EconomyProvider import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astrashop.AstraShop import ru.astrainteractive.astrashop.domain.SpigotShopApi -import ru.astrainteractive.astrashop.utils.PluginTranslation +import ru.astrainteractive.astrashop.util.PluginTranslation interface RootModule : Module { val plugin: Lateinit diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandsModuleImpl.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandModuleImpl.kt similarity index 76% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandsModuleImpl.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandModuleImpl.kt index 97fe6dd..163f971 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandsModuleImpl.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/CommandModuleImpl.kt @@ -4,10 +4,10 @@ import ru.astrainteractive.astralibs.Dependency import ru.astrainteractive.astralibs.async.AsyncComponent import ru.astrainteractive.astralibs.async.BukkitDispatchers import ru.astrainteractive.astralibs.getValue -import ru.astrainteractive.astrashop.commands.di.CommandsModule -import ru.astrainteractive.astrashop.utils.PluginTranslation +import ru.astrainteractive.astrashop.command.di.CommandModule +import ru.astrainteractive.astrashop.util.PluginTranslation -object CommandsModuleImpl : CommandsModule { +object CommandModuleImpl : CommandModule { private val rootModule by RootModuleImpl override val translation: Dependency = rootModule.translation override val scope: Dependency = rootModule.scope diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/RootModuleImpl.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/RootModuleImpl.kt index eff7540..2d4525d 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/RootModuleImpl.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/di/impl/RootModuleImpl.kt @@ -19,7 +19,7 @@ import ru.astrainteractive.astralibs.utils.buildWithSpigot import ru.astrainteractive.astrashop.AstraShop import ru.astrainteractive.astrashop.di.RootModule import ru.astrainteractive.astrashop.domain.SpigotShopApi -import ru.astrainteractive.astrashop.utils.PluginTranslation +import ru.astrainteractive.astrashop.util.PluginTranslation object RootModuleImpl : RootModule { override val plugin: Lateinit = Lateinit() diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/BuyUseCase.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/BuyUseCase.kt index 4898343..509015d 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/BuyUseCase.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/BuyUseCase.kt @@ -9,9 +9,9 @@ import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astrashop.domain.calculator.PriceCalculator import ru.astrainteractive.astrashop.domain.models.ShopConfig import ru.astrainteractive.astrashop.domain.models.SpigotShopItem -import ru.astrainteractive.astrashop.utils.copy -import ru.astrainteractive.astrashop.utils.hasAtLeast -import ru.astrainteractive.astrashop.utils.toItemStack +import ru.astrainteractive.astrashop.util.copy +import ru.astrainteractive.astrashop.util.hasAtLeast +import ru.astrainteractive.astrashop.util.toItemStack class BuyUseCase( private val economy: EconomyProvider, diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/SellUseCase.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/SellUseCase.kt index 9773bd7..6fefbb4 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/SellUseCase.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/domain/usecases/SellUseCase.kt @@ -8,7 +8,7 @@ import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astrashop.domain.calculator.PriceCalculator import ru.astrainteractive.astrashop.domain.models.ShopConfig import ru.astrainteractive.astrashop.domain.models.SpigotShopItem -import ru.astrainteractive.astrashop.utils.copy +import ru.astrainteractive.astrashop.util.copy class SellUseCase( private val economy: EconomyProvider, diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/Button.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/Button.kt index a033301..a6f5193 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/Button.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/Button.kt @@ -17,7 +17,7 @@ import ru.astrainteractive.astrashop.domain.models.SpigotShopItem import ru.astrainteractive.astrashop.domain.models.SpigotTitleItem import ru.astrainteractive.astrashop.gui.buy.BuyState import ru.astrainteractive.astrashop.gui.shop.ShopGUI -import ru.astrainteractive.astrashop.utils.openOnMainThread +import ru.astrainteractive.astrashop.util.openOnMainThread fun button( index: Int, diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/buy/BuyGUI.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/buy/BuyGUI.kt index 92d1174..9cf039c 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/buy/BuyGUI.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/buy/BuyGUI.kt @@ -19,8 +19,8 @@ import ru.astrainteractive.astrashop.gui.BuyInfoButton import ru.astrainteractive.astrashop.gui.SellInfoButton import ru.astrainteractive.astrashop.gui.ShopPlayerHolder import ru.astrainteractive.astrashop.gui.button -import ru.astrainteractive.astrashop.utils.copy -import ru.astrainteractive.astrashop.utils.toItemStack +import ru.astrainteractive.astrashop.util.copy +import ru.astrainteractive.astrashop.util.toItemStack import kotlin.math.pow class BuyGUI( diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopGUI.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopGUI.kt index 01c5d67..09dd10d 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopGUI.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopGUI.kt @@ -21,8 +21,8 @@ import ru.astrainteractive.astrashop.gui.ShopPlayerHolder import ru.astrainteractive.astrashop.gui.button import ru.astrainteractive.astrashop.gui.shop.state.ShopIntent import ru.astrainteractive.astrashop.gui.shop.state.ShopListState -import ru.astrainteractive.astrashop.utils.PluginPermission -import ru.astrainteractive.astrashop.utils.toItemStack +import ru.astrainteractive.astrashop.util.PluginPermission +import ru.astrainteractive.astrashop.util.toItemStack class ShopGUI( private val shopConfig: SpigotShopConfigAlias, diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopViewModel.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopViewModel.kt index 38a653b..8fea2ed 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopViewModel.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shop/ShopViewModel.kt @@ -12,8 +12,8 @@ import ru.astrainteractive.astrashop.gui.buy.BuyGUI import ru.astrainteractive.astrashop.gui.shop.state.ShopIntent import ru.astrainteractive.astrashop.gui.shop.state.ShopListState import ru.astrainteractive.astrashop.gui.shops.ShopsGUI -import ru.astrainteractive.astrashop.utils.asShopItem -import ru.astrainteractive.astrashop.utils.openOnMainThread +import ru.astrainteractive.astrashop.util.asShopItem +import ru.astrainteractive.astrashop.util.openOnMainThread class ShopViewModel( private val configName: String, diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shops/ShopsGUI.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shops/ShopsGUI.kt index 13b1f4c..2e3e232 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shops/ShopsGUI.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/gui/shops/ShopsGUI.kt @@ -16,9 +16,9 @@ import ru.astrainteractive.astrashop.gui.PrevButton import ru.astrainteractive.astrashop.gui.ShopPlayerHolder import ru.astrainteractive.astrashop.gui.button import ru.astrainteractive.astrashop.gui.shop.ShopGUI -import ru.astrainteractive.astrashop.utils.inventoryIndex -import ru.astrainteractive.astrashop.utils.openOnMainThread -import ru.astrainteractive.astrashop.utils.toItemStack +import ru.astrainteractive.astrashop.util.inventoryIndex +import ru.astrainteractive.astrashop.util.openOnMainThread +import ru.astrainteractive.astrashop.util.toItemStack class ShopsGUI(override val playerHolder: ShopPlayerHolder) : PaginatedMenu() { diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/MockEconomyProvider.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/MockEconomyProvider.kt similarity index 90% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/MockEconomyProvider.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/MockEconomyProvider.kt index 5ab0a27..966a1d6 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/MockEconomyProvider.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/MockEconomyProvider.kt @@ -1,4 +1,4 @@ -package ru.astrainteractive.astrashop.utils +package ru.astrainteractive.astrashop.util import ru.astrainteractive.astralibs.economy.EconomyProvider import java.util.* diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginPermission.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginPermission.kt similarity index 89% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginPermission.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginPermission.kt index acad69f..14b1bab 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginPermission.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginPermission.kt @@ -1,4 +1,4 @@ -package ru.astrainteractive.astrashop.utils +package ru.astrainteractive.astrashop.util import ru.astrainteractive.astralibs.utils.Permission diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginTranslation.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginTranslation.kt similarity index 98% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginTranslation.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginTranslation.kt index d53899f..14ddea4 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/PluginTranslation.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/PluginTranslation.kt @@ -1,4 +1,4 @@ -package ru.astrainteractive.astrashop.utils +package ru.astrainteractive.astrashop.util import ru.astrainteractive.astralibs.filemanager.SpigotFileManager import ru.astrainteractive.astralibs.utils.BaseTranslation diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/ext.kt b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/ext.kt similarity index 96% rename from plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/ext.kt rename to plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/ext.kt index 4468c47..b73af22 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astrashop/utils/ext.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astrashop/util/ext.kt @@ -1,4 +1,6 @@ -package ru.astrainteractive.astrashop.utils +@file:Suppress("Filename") + +package ru.astrainteractive.astrashop.util import kotlinx.coroutines.withContext import org.bukkit.inventory.ItemStack diff --git a/settings.gradle.kts b/settings.gradle.kts index 1f40c8b..6bc7db1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,4 @@ pluginManagement { - includeBuild("build-logic") repositories { mavenLocal() mavenCentral()