Skip to content

Commit

Permalink
feat(main-command): add about subcommand, and change method names
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanGmG committed Jul 29, 2023
1 parent ad50897 commit 1f7fbf0
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions plugin/src/main/java/me/bryang/chatlab/command/MainCommand.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,55 @@
package me.bryang.chatlab.command;

import me.bryang.chatlab.UpdateCheckHandler;
import me.bryang.chatlab.configuration.ConfigurationContainer;
import me.bryang.chatlab.configuration.section.MessageSection;
import me.bryang.chatlab.configuration.section.RootSection;
import me.bryang.chatlab.message.MessageManager;
import me.fixeddev.commandflow.annotated.CommandClass;
import me.fixeddev.commandflow.annotated.annotation.Command;
import me.fixeddev.commandflow.bukkit.annotation.Sender;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.entity.Player;
import team.unnamed.inject.InjectAll;

@Command(names = {"clab", "chatlab"})
import javax.inject.Named;

@Command(
names = {"clab", "chatlab"},
desc = "Command to manage the plugin.")
@InjectAll
public class MainCommand implements CommandClass {

private ConfigurationContainer<RootSection> configurationContainer;
private ConfigurationContainer<MessageSection> messageContainer;
private UpdateCheckHandler updateChecker;
private MessageManager messageManager;
@Named("plugin-version")
private String pluginVersion;

@Command(names = {""})
public void executeMainSubCommand(@Sender Player sender) {
messageManager.sendMessage(sender, """
<blue>ChatLab: <white>Main plugin command.
<dark_grey>- <white>/clab reload <dark_grey>: <green>Reload the plugin.
<dark_grey>- <white>/clab check-update <dark_grey>: <green>Check update.
<dark_grey>- <white>/clab re-check <dark_grey>: <green>Send a request if has a new update.
<dark_grey>- <white>/clab about <dark_grey>: <green>See about the plugin.""");

}
@Command(names = "about")
public void executeAboutSubCommand(@Sender Player sender) {

messageManager.sendMessage(sender, """
<green>ChatLab <dark_gray>- <white>Chat plugin.<white>
<blue><version>
<green>>> <white>Source code: <green><u><click:open_url:'https://github.com/devblook/chatlab>[GitHub]</click></u>""",
Placeholder.unparsed("version", pluginVersion));

@Command(names = "")
public void mainSubCommand(@Sender Player sender) {
messageManager.sendMessage(sender, "<blue>ChatLab: <white>Main plugin command.");
messageManager.sendMessage(sender, "<dark_grey>- <white>/clab reload");
}

@Command(names = "reload", permission = "clab.reload")
public void reloadSubCommand(@Sender Player sender) {
public void executeReloadSubCommand(@Sender Player sender) {

configurationContainer.reload();
messageContainer.reload();
Expand Down

0 comments on commit 1f7fbf0

Please sign in to comment.