Add root command to show plugin info.

This commit is contained in:
benwoo1110 2020-12-23 18:17:31 +08:00
parent e4a6e8a9ec
commit 20b492fa3c
2 changed files with 40 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import com.onarandombox.MultiverseCore.commands.PurgeCommand;
import com.onarandombox.MultiverseCore.commands.RegenCommand;
import com.onarandombox.MultiverseCore.commands.ReloadCommand;
import com.onarandombox.MultiverseCore.commands.RemoveCommand;
import com.onarandombox.MultiverseCore.commands.RootCommand;
import com.onarandombox.MultiverseCore.commands.ScriptCommand;
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
import com.onarandombox.MultiverseCore.commands.SilentCommand;
@ -45,6 +46,10 @@ import com.onarandombox.MultiverseCore.commands.UnloadCommand;
import com.onarandombox.MultiverseCore.commands.UsageCommand;
import com.onarandombox.MultiverseCore.commands.VersionCommand;
import com.onarandombox.MultiverseCore.commands.WhoCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.PluginDescriptionFile;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.List;
@ -97,6 +102,7 @@ public class MVCommandManager extends PaperCommandManager {
registerCommand(new BedCommand(this.plugin));
registerCommand(new AnchorCommand(this.plugin));
registerCommand(new WhoCommand(this.plugin));
registerCommand(new RootCommand(this.plugin));
}
@Override
@ -157,4 +163,13 @@ public class MVCommandManager extends PaperCommandManager {
public CommandQueueManager getQueueManager() {
return commandQueueManager;
}
public void showPluginInfo(@NotNull CommandSender sender,
@NotNull PluginDescriptionFile description,
@NotNull ColourAlternator colour,
@NotNull String baseCommand) {
sender.sendMessage(colour.getColorThis() + description.getName() + ChatColor.DARK_GRAY + " | " + colour.getColorThat() + "v" + description.getVersion());
sender.sendMessage(ChatColor.DARK_GREEN + "See " + ChatColor.GREEN + "/" + baseCommand + " help " + ChatColor.DARK_GREEN + "for commands available.");
}
}

View File

@ -0,0 +1,25 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.annotation.CommandAlias;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.commandTools.ColourAlternator;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class RootCommand extends MultiverseCommand {
public RootCommand(MultiverseCore plugin) {
super(plugin);
}
@CommandAlias("mv")
public void onRootCommand(@NotNull CommandSender sender) {
this.plugin.getMVCommandManager().showPluginInfo(
sender,
this.plugin.getDescription(),
new ColourAlternator(ChatColor.GOLD, ChatColor.YELLOW),
"mv"
);
}
}