From e81aea1cccb1510a2d759049d47b9534ec4fd65d Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:32:34 -0700 Subject: [PATCH] Use AudienceLocaleExtractor --- build.gradle.kts | 5 +++-- .../xyz/jpenilla/wanderingtrades/command/Commands.java | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5c7108a..170729c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,8 +44,9 @@ dependencies { implementation(platform("org.incendo:cloud-minecraft-bom:2.0.0-beta.3")) implementation("org.incendo:cloud-paper") implementation("org.incendo:cloud-minecraft-extras") - implementation("org.incendo:cloud-translations-bukkit:1.0.0-SNAPSHOT") - implementation("org.incendo:cloud-translations-minecraft-extras:1.0.0-SNAPSHOT") + implementation(platform("org.incendo:cloud-translations-bom:1.0.0-SNAPSHOT")) + implementation("org.incendo:cloud-translations-bukkit") + implementation("org.incendo:cloud-translations-minecraft-extras") implementation("org.incendo.interfaces", "interfaces-paper", "1.0.0-SNAPSHOT") diff --git a/src/main/java/xyz/jpenilla/wanderingtrades/command/Commands.java b/src/main/java/xyz/jpenilla/wanderingtrades/command/Commands.java index 4384bfd..c9d5b6a 100644 --- a/src/main/java/xyz/jpenilla/wanderingtrades/command/Commands.java +++ b/src/main/java/xyz/jpenilla/wanderingtrades/command/Commands.java @@ -4,9 +4,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.kyori.adventure.identity.Identity; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.Command; @@ -29,6 +27,7 @@ import static org.incendo.cloud.translations.TranslationBundle.core; import static org.incendo.cloud.translations.bukkit.BukkitTranslationBundle.bukkit; +import static org.incendo.cloud.translations.minecraft.extras.AudienceLocaleExtractor.audienceLocaleExtractor; import static org.incendo.cloud.translations.minecraft.extras.MinecraftExtrasTranslationBundle.minecraftExtras; @DefaultQualifier(NonNull.class) @@ -72,9 +71,7 @@ public CommandManager commandManager() { } private void registerCaptions() { - final LocaleExtractor extractor = LocaleExtractor.builder() - .senderType(Player.class, player -> this.plugin.audiences().player(player).get(Identity.LOCALE).orElse(null)) - .build(); + final LocaleExtractor extractor = audienceLocaleExtractor(this.plugin.audiences()::sender); this.commandManager.captionRegistry() .registerProvider(minecraftExtras(extractor)) .registerProvider(bukkit(extractor))