mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 23:01:03 +00:00
Add packs list command.
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
package com.dfsek.terra.command;
|
||||||
|
|
||||||
|
import com.dfsek.terra.config.base.ConfigPackTemplate;
|
||||||
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
|
import com.dfsek.terra.registry.ConfigRegistry;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.polydev.gaea.command.Command;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PacksCommand extends Command {
|
||||||
|
public PacksCommand(Command parent) {
|
||||||
|
super(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "packs";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Command> getSubCommands() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull CommandSender commandSender, org.bukkit.command.@NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||||
|
|
||||||
|
ConfigRegistry registry = ConfigRegistry.getRegistry();
|
||||||
|
|
||||||
|
if(registry.entries().size() == 0) {
|
||||||
|
LangUtil.send("command.packs.none", commandSender);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LangUtil.send("command.packs.main", commandSender);
|
||||||
|
registry.entries().forEach(entry -> {
|
||||||
|
ConfigPackTemplate template = entry.getTemplate();
|
||||||
|
LangUtil.send("command.packs.pack", commandSender, template.getID(), template.getAuthor());
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int arguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTabCompletions(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,8 @@ public class TerraCommand extends Command {
|
|||||||
new ImageCommand(this),
|
new ImageCommand(this),
|
||||||
new GeometryCommand(this),
|
new GeometryCommand(this),
|
||||||
new FixChunkCommand(this),
|
new FixChunkCommand(this),
|
||||||
new VersionCommand(this));
|
new VersionCommand(this),
|
||||||
|
new PacksCommand(this));
|
||||||
|
|
||||||
public TerraCommand(GaeaPlugin main) {
|
public TerraCommand(GaeaPlugin main) {
|
||||||
super(main);
|
super(main);
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ command:
|
|||||||
invalid-radius: "Invalid radius: \"%s\""
|
invalid-radius: "Invalid radius: \"%s\""
|
||||||
invalid: "Invalid Biome ID: \"%s\""
|
invalid: "Invalid Biome ID: \"%s\""
|
||||||
in: "You are in \"%s\""
|
in: "You are in \"%s\""
|
||||||
|
packs:
|
||||||
|
main: "Currently installed config packs:"
|
||||||
|
pack: " - %1$s by %2$s"
|
||||||
|
none: "No config packs are installed."
|
||||||
ore:
|
ore:
|
||||||
main-menu:
|
main-menu:
|
||||||
- "---------------Terra/ore---------------"
|
- "---------------Terra/ore---------------"
|
||||||
|
|||||||
Reference in New Issue
Block a user