Skip to content

Commit

Permalink
Use LanguageManager#setLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
EsotericEnderman committed Aug 3, 2024
1 parent 2193b7f commit 98ce3f8
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import net.kyori.adventure.text.Component;
import net.slqmy.template_paper_plugin.TemplatePaperPlugin;
import net.slqmy.template_paper_plugin.data.player.PlayerDataManager;
import net.slqmy.template_paper_plugin.data.player.PlayerProfile;
import net.slqmy.template_paper_plugin.language.LanguageManager;
import net.slqmy.template_paper_plugin.language.Message;

Expand All @@ -27,8 +25,6 @@ public SetLanguageCommand(TemplatePaperPlugin plugin) {
super("set-language");

LanguageManager languageManager = plugin.getLanguageManager();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();

Set<String> languages = languageManager.getLanguages();

String languageArgumentNodeName = "language";
Expand Down Expand Up @@ -60,9 +56,7 @@ public String apply(CustomArgumentInfo<String> info) throws CustomArgumentExcept

executesPlayer((player, arguments) -> {
String selectedLanguage = (String) arguments.get(languageArgumentNodeName);

PlayerProfile profile = playerDataManager.getPlayerProfile(player);
profile.setLanguage(selectedLanguage);
languageManager.setLanguage(player, selectedLanguage);

player.sendMessage(languageManager.getMessage(Message.SET_LANGUAGE_SUCCESSFULLY, player, selectedLanguage));
});
Expand Down

0 comments on commit 98ce3f8

Please sign in to comment.