From 65875a07e13e8203a27303f01d00a2af233757b3 Mon Sep 17 00:00:00 2001 From: srnyx <25808801+srnyx@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:19:21 -0400 Subject: [PATCH] Remove Adventure stuff Moved to `adventure` branch --- .../gradlegalaxy/data/AdventureDependency.kt | 53 +------------------ .../gradlegalaxy/utility/Dependencies.kt | 20 ++----- .../xyz/srnyx/gradlegalaxy/utility/Scripts.kt | 6 +-- 3 files changed, 7 insertions(+), 72 deletions(-) diff --git a/src/main/kotlin/xyz/srnyx/gradlegalaxy/data/AdventureDependency.kt b/src/main/kotlin/xyz/srnyx/gradlegalaxy/data/AdventureDependency.kt index 2d7aeb0..91358a9 100644 --- a/src/main/kotlin/xyz/srnyx/gradlegalaxy/data/AdventureDependency.kt +++ b/src/main/kotlin/xyz/srnyx/gradlegalaxy/data/AdventureDependency.kt @@ -1,9 +1,7 @@ package xyz.srnyx.gradlegalaxy.data import org.gradle.api.artifacts.ExternalModuleDependency -import org.gradle.kotlin.dsl.exclude -import xyz.srnyx.gradlegalaxy.enums.AdventureComponent import xyz.srnyx.gradlegalaxy.enums.Component @@ -15,53 +13,4 @@ import xyz.srnyx.gradlegalaxy.enums.Component * @param configuration The configuration to add the dependency to * @param configurationAction The action to apply to the dependency */ -data class AdventureDependency(val component: Component, val version: String, val configuration: String? = null, val configurationAction: ExternalModuleDependency.() -> Unit = {}) { - companion object { - /** - * Gets the default Adventure dependencies for Annoying API (Spigot) - * - * @param configuration The configuration to add the dependencies to - * @param apiVersion The version of [AdventureComponent.API] to depend on - * @param textMinimessageVersion The version of [AdventureComponent.Text.MINIMESSAGE] to depend on - * @param textSerializerLegacyVersion The version of [AdventureComponent.Text.Serializer.LEGACY] to depend on - * @param textSerializerPlainVersion The version of [AdventureComponent.Text.Serializer.PLAIN] to depend on - * @param platformBukkitVersion The version of [AdventureComponent.Platform.BUKKIT] to depend on - * @param textLoggerSlf4j The version of [AdventureComponent.Text.Logger.SLF4J] to depend on - * - * @return The default Adventure dependencies for Annoying API (Spigot) - */ - fun getDefaultAnnoyingSpigot( - configuration: String = "implementation", - apiVersion: String = "4.14.0", - textMinimessageVersion: String = "4.14.0", - textSerializerLegacyVersion: String = "4.14.0", - textSerializerPlainVersion: String = "4.14.0", - platformBukkitVersion: String = "4.3.0", - textLoggerSlf4j: String = "4.14.0", - ): Array = arrayOf( - *getDefaultAnnoyingPaper(configuration, textSerializerLegacyVersion, platformBukkitVersion), - AdventureDependency(AdventureComponent.API, apiVersion, configuration), - AdventureDependency(AdventureComponent.Text.MINIMESSAGE, textMinimessageVersion, configuration), - AdventureDependency(AdventureComponent.Text.Serializer.PLAIN, textSerializerPlainVersion, configuration), - AdventureDependency(AdventureComponent.Text.Logger.SLF4J, textLoggerSlf4j, configuration)) - - /** - * Gets the default Adventure dependencies for Annoying API (Paper) - * - * @param configuration The configuration to add the dependencies to - * @param textSerializerLegacyVersion The version of [AdventureComponent.Text.Serializer.LEGACY] to depend on - * @param platformBukkitVersion The version of [AdventureComponent.Platform.BUKKIT] to depend on - * - * @return The default Adventure dependencies for Annoying API (Paper) - */ - fun getDefaultAnnoyingPaper( - configuration: String = "implementation", - textSerializerLegacyVersion: String = "4.14.0", - platformBukkitVersion: String = "4.3.0", - ): Array = arrayOf( - AdventureDependency(AdventureComponent.Text.Serializer.LEGACY, textSerializerLegacyVersion, configuration) { - exclude("org.jetbrains", "annotations") - }, - AdventureDependency(AdventureComponent.Platform.BUKKIT, platformBukkitVersion, configuration)) - } -} +data class AdventureDependency(val component: Component, val version: String, val configuration: String? = null, val configurationAction: ExternalModuleDependency.() -> Unit = {}) diff --git a/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Dependencies.kt b/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Dependencies.kt index 31eec74..108ebb5 100644 --- a/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Dependencies.kt +++ b/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Dependencies.kt @@ -103,34 +103,24 @@ fun Project.adventure(vararg dependencies: AdventureDependency, configurationAll } /** - * 1. Calls [adventure] with the provided [AdventureDependencies][AdventureDependency] if any are provided - * 2. Adds the [Repository.JITPACK] repository - * 3. Adds the dependency to the provided Annoying API version + * 1. Adds the [Repository.JITPACK] repository + * 2. Adds the dependency to the provided Annoying API version * * @param version The version of Annoying API to use - * @param adventureDependencies The Adventure dependencies to add - * @param adventureConfigurationAll The configuration to use for the Adventure dependencies if they don't have one specified - * @param annoyingApiConfiguration The configuration to add the dependency to + * @param configuration The configuration to add the dependency to * @param configurationAction The action to apply to the dependency * * @return The [ExternalModuleDependency] of the added Annoying API dependency */ fun Project.annoyingAPI( version: String, - vararg adventureDependencies: AdventureDependency = emptyArray(), - adventureConfigurationAll: String? = null, - annoyingApiConfiguration: String = "implementation", + configuration: String = "implementation", configurationAction: ExternalModuleDependency.() -> Unit = {} ): ExternalModuleDependency { check(hasJavaPlugin()) { "Java plugin is not applied!" } - - // Adventure - if (adventureDependencies.isNotEmpty()) adventure(*adventureDependencies, configurationAll = adventureConfigurationAll) - - // Annoying API repository(Repository.JITPACK) if (hasShadowPlugin()) relocate("xyz.srnyx.annoyingapi") - return addDependencyTo(dependencies, annoyingApiConfiguration, "xyz.srnyx:annoying-api:$version") { + return addDependencyTo(dependencies, configuration, "xyz.srnyx:annoying-api:$version") { exclude("org.reflections") exclude("org.bstats", "bstats-bukkit") exclude("de.tr7zw", "item-nbt-api") diff --git a/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt b/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt index 60ac621..086c7ac 100644 --- a/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt +++ b/src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt @@ -233,8 +233,6 @@ fun Project.setupMC( * @param group The group of the project (example: `xyz.srnyx`) * @param version The version of the project (example: `1.0.0`) * @param description The description of the project - * @param adventureDependencies The []Adventure dependencies][AdventureDependency] to add - * @param adventureConfigurationAll The configuration for all the Adventure dependencies if they don't already have one * @param javaVersion The java version of the project (example: [JavaVersion.VERSION_1_8]) * @param replacements The replacements for the [replacements task][addReplacementsTask] * @param textEncoding The text encoding for the [text encoding task][setTextEncoding] @@ -247,8 +245,6 @@ fun Project.setupAnnoyingAPI( group: String = project.group.toString(), version: String = project.version.toString(), description: String? = project.description, - vararg adventureDependencies: AdventureDependency = AdventureDependency.getDefaultAnnoyingSpigot(), - adventureConfigurationAll: String? = null, javaVersion: JavaVersion? = null, replacementFiles: Set? = setOf("plugin.yml"), replacements: Map? = getSentinelReplacements(), @@ -259,7 +255,7 @@ fun Project.setupAnnoyingAPI( ): ExternalModuleDependency { check(hasShadowPlugin()) { "Shadow plugin is required for Annoying API!" } setupMC(group, version, description, javaVersion, replacementFiles, replacements, textEncoding, archiveClassifier) - return annoyingAPI(annoyingAPIVersion, adventureDependencies = adventureDependencies, adventureConfigurationAll, configuration, configurationAction) + return annoyingAPI(annoyingAPIVersion, configuration, configurationAction) } /**