Skip to content

Commit

Permalink
Use AudienceLocaleExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Feb 16, 2024
1 parent e8c7f5d commit e81aea1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -72,9 +71,7 @@ public CommandManager<CommandSender> commandManager() {
}

private void registerCaptions() {
final LocaleExtractor<CommandSender> extractor = LocaleExtractor.<CommandSender>builder()
.senderType(Player.class, player -> this.plugin.audiences().player(player).get(Identity.LOCALE).orElse(null))
.build();
final LocaleExtractor<CommandSender> extractor = audienceLocaleExtractor(this.plugin.audiences()::sender);
this.commandManager.captionRegistry()
.registerProvider(minecraftExtras(extractor))
.registerProvider(bukkit(extractor))
Expand Down

0 comments on commit e81aea1

Please sign in to comment.