Skip to content

Commit

Permalink
Remove Adventure stuff
Browse files Browse the repository at this point in the history
Moved to `adventure` branch
  • Loading branch information
srnyx committed Jul 7, 2023
1 parent fe0ecfa commit 65875a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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<AdventureDependency> = 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<AdventureDependency> = 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 = {})
20 changes: 5 additions & 15 deletions src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 1 addition & 5 deletions src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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<String>? = setOf("plugin.yml"),
replacements: Map<String, String>? = getSentinelReplacements(),
Expand All @@ -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)
}

/**
Expand Down

0 comments on commit 65875a0

Please sign in to comment.