Skip to content

Commit

Permalink
Add set language command with language arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Aug 2, 2024
1 parent 38d2362 commit 7044bf8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import dev.jorel.commandapi.CommandAPI;
import dev.jorel.commandapi.CommandAPIBukkitConfig;

import net.slqmy.template_paper_plugin.commands.SetLanguageCommand;
import net.slqmy.template_paper_plugin.data.player.PlayerDataManager;
import net.slqmy.template_paper_plugin.language.LanguageManager;

Expand Down Expand Up @@ -35,6 +35,8 @@ public void onEnable() {

playerDataManager = new PlayerDataManager(this);
languageManager = new LanguageManager(this);

new SetLanguageCommand(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.slqmy.template_paper_plugin.commands;

import dev.jorel.commandapi.CommandAPICommand;
import dev.jorel.commandapi.arguments.MultiLiteralArgument;

import java.util.stream.Stream;

import net.slqmy.template_paper_plugin.TemplatePaperPlugin;
import net.slqmy.template_paper_plugin.language.Language;
import net.slqmy.template_paper_plugin.language.LanguageData;

public class SetLanguageCommand extends CommandAPICommand {

public SetLanguageCommand(TemplatePaperPlugin plugin) {
super("set-language");

withArguments(new MultiLiteralArgument("language", Stream.of(Language.values()).map((language) -> {
LanguageData data = plugin.getLanguageManager().getLanguageData(language);

return data.getName();
}).toArray(String[]::new)));

executes((sender, arguments) -> {

});

register(plugin);
}
}

0 comments on commit 7044bf8

Please sign in to comment.