Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest Linkie + 3 new namespaces #243

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ class MappingsExtension : Extension() {

enabledNamespaces.forEach {
when (it) {
"barn" -> namespaces.add(BarnNamespace)
"feather" -> namespaces.add(FeatherNamespace)
"legacy-yarn" -> namespaces.add(LegacyYarnNamespace)
"mcp" -> namespaces.add(McpNamespaceReplacement)
"mojang" -> namespaces.add(MojangNamespace)
"hashed-mojang" -> namespaces.add(MojangHashedNamespace)
"plasma" -> namespaces.add(PlasmaNamespace)
"quilt-mappings" -> namespaces.add(QuiltMappingsNamespace)
"srg-mojang" -> namespaces.add(MojangSrgNamespace)
"yarn" -> namespaces.add(YarnNamespace)
"yarrn" -> namespaces.add(YarrnNamespace)

Expand All @@ -93,12 +96,15 @@ class MappingsExtension : Extension() {

Namespaces.init(LinkieConfig.DEFAULT.copy(namespaces = namespaces))

val barnEnabled = enabledNamespaces.contains("barn")
val featherEnabled = enabledNamespaces.contains("feather")
val legacyYarnEnabled = enabledNamespaces.contains("legacy-yarn")
val mcpEnabled = enabledNamespaces.contains("mcp")
val mojangEnabled = enabledNamespaces.contains("mojang")
val hashedMojangEnabled = enabledNamespaces.contains("hashed-mojang")
val plasmaEnabled = enabledNamespaces.contains("plasma")
val quiltMappingsEnabled = enabledNamespaces.contains("quilt-mappings")
val srgMojangEnabled = enabledNamespaces.contains("srg-mojang")
val yarnEnabled = enabledNamespaces.contains("yarn")
val yarrnEnabled = enabledNamespaces.contains("yarrn")

Expand Down Expand Up @@ -254,6 +260,32 @@ class MappingsExtension : Extension() {
}
}

// region: Barn mappings lookups

if (barnEnabled) {
slashCommand(
"barn",
"Barn",
BarnNamespace,
::BarnArguments
)
}

// endregion

// region: Feather mappings lookups

if (featherEnabled) {
slashCommand(
"feather",
"Feather",
FeatherNamespace,
::FeatherArguments
)
}

// endregion

// region: Legacy Yarn mappings lookups

if (legacyYarnEnabled) {
Expand Down Expand Up @@ -441,6 +473,19 @@ class MappingsExtension : Extension() {

// endregion

// region: SRG Mojang mappings lookups

if (srgMojangEnabled) {
slashCommand(
"srg",
"SRG Mojang",
MojangSrgNamespace,
::SrgMojangArguments
)
}

// endregion

// region: Yarn mappings lookups

if (yarnEnabled) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments

import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean
import me.shedaniel.linkie.namespaces.BarnNamespace

/** Arguments for Barn mappings lookup commands. **/
@Suppress("UndocumentedPublicProperty")
class BarnArguments : MappingArguments(BarnNamespace), IntermediaryMappable {
override val mapDescriptors by defaultingBoolean {
name = "map-descriptor"
description = "Whether to map field/method descriptors to named instead of intermediary"
defaultValue = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments

import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean
import me.shedaniel.linkie.namespaces.FeatherNamespace

/** Arguments for Feather mappings lookup commands. **/
@Suppress("UndocumentedPublicProperty")
class FeatherArguments : MappingArguments(FeatherNamespace), IntermediaryMappable {
override val mapDescriptors by defaultingBoolean {
name = "map-descriptor"
description = "Whether to map field/method descriptors to named instead of Calamus"
defaultValue = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments

import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean
import me.shedaniel.linkie.namespaces.MojangSrgNamespace

/** Arguments for SRG Mojang mappings lookup commands. **/
@Suppress("UndocumentedPublicProperty")
class SrgMojangArguments : MappingArguments(MojangSrgNamespace), IntermediaryMappable {
override val mapDescriptors by defaultingBoolean {
name = "map-descriptor"
description = "Whether to map field/method descriptors to named instead of SRG"
defaultValue = true
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ksp = "1.9.10-1.0.13"
ktor = "2.3.4"
kx-coro = "1.7.3"
kx-ser = "1.6.0"
linkie = "1.0.99"
linkie = "1.0.114"
logback = "1.4.11"
logback-groovy = "1.14.5"
logging = "5.1.0"
Expand Down