Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/root' into root
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Sep 30, 2023
2 parents 34570f2 + 013533b commit cc70462
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
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

0 comments on commit cc70462

Please sign in to comment.