From 5abb762e3449852331fca7d8cc26e0feb94e584c Mon Sep 17 00:00:00 2001 From: rushiiMachine <33725716+rushiiMachine@users.noreply.github.com> Date: Sat, 24 Aug 2024 12:15:17 -0700 Subject: [PATCH] feat: allow plugin authors to disable hyperlinking profile --- .../com/aliucord/gradle/AliucordExtension.kt | 22 ++++++++++++++++--- .../gradle/entities/PluginManifest.kt | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/aliucord/gradle/AliucordExtension.kt b/src/main/kotlin/com/aliucord/gradle/AliucordExtension.kt index 8f83977..54edead 100644 --- a/src/main/kotlin/com/aliucord/gradle/AliucordExtension.kt +++ b/src/main/kotlin/com/aliucord/gradle/AliucordExtension.kt @@ -29,12 +29,28 @@ abstract class AliucordExtension @Inject constructor(val project: Project) { val authors: ListProperty = project.objects.listProperty(Author::class.java) - fun author(name: String, id: Long) { - authors.add(Author(name, id)) - } + /** + * Specify an author of this plugin. + * + * @param name The user-facing name to display + * @param id The Discord ID of the author, optional. + * This also will allow Aliucord to show a badge on your profile if the plugin is installed. + * @param hyperlink Whether to hyperlink the Discord profile specified by [id]. + * Set this to false if you don't want to be spammed for support. + */ + fun author(name: String, id: Long = 0L, hyperlink: Boolean = true) = + authors.add(Author(name, id, hyperlink)) val links: Links = Links() + /** + * Set the source repository of this plugin. + * If you are not posting the source on Github, then [updateUrl] and [buildUrl] will need + * to be set manually to a compatible Github repository of builds. + * Otherwise, if [updateUrl] and [buildUrl] have not set yet, then they will be generated based on the supplied url. + * + * @param url A repository url like `https://github.com/Aliucord/plugins-template` + */ fun github(url: String) { links.github = url diff --git a/src/main/kotlin/com/aliucord/gradle/entities/PluginManifest.kt b/src/main/kotlin/com/aliucord/gradle/entities/PluginManifest.kt index c191237..4ab3d6a 100644 --- a/src/main/kotlin/com/aliucord/gradle/entities/PluginManifest.kt +++ b/src/main/kotlin/com/aliucord/gradle/entities/PluginManifest.kt @@ -18,6 +18,7 @@ package com.aliucord.gradle.entities data class Author( val name: String, val id: Long, + val hyperlink: Boolean, ) class Links : HashMap() {