Improve download suggestion.

Now shows download link even when extra args like `/mvp more stuff` is entered.
This commit is contained in:
benwoo1110 2020-12-30 23:29:07 +08:00
parent 3962f23691
commit 6771bb6c44

View File

@ -1,9 +1,11 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.CommandHelp;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.HelpCommand;
import com.onarandombox.MultiverseCore.commandTools.display.ColourAlternator;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@ -12,10 +14,14 @@ import org.jetbrains.annotations.NotNull;
public class SubModulesCommand {
public static class NetherPortals extends BaseCommand {
@HelpCommand
@CommandAlias("mvnp")
@CommandPermission("multiverse.core.submodules")
@Description("Suggest download for Multiverse-NetherPortals.")
public void onSuggestCommand(@NotNull CommandSender sender) {
public void onSuggestCommand(@NotNull CommandSender sender,
@NotNull CommandHelp help) {
suggestDownload(
sender,
"Multiverse-NetherPortals",
@ -26,10 +32,14 @@ public class SubModulesCommand {
}
public static class Portals extends BaseCommand {
@HelpCommand
@CommandAlias("mvp")
@CommandPermission("multiverse.core.submodules")
@Description("Suggest download for Multiverse-Portals.")
public void onSuggestCommand(@NotNull CommandSender sender) {
public void onSuggestCommand(@NotNull CommandSender sender,
@NotNull CommandHelp help) {
suggestDownload(
sender,
"Multiverse-Portals",
@ -40,10 +50,14 @@ public class SubModulesCommand {
}
public static class Inventories extends BaseCommand {
@HelpCommand
@CommandAlias("mvinv")
@CommandPermission("multiverse.core.submodules")
@Description("Suggest download for Multiverse-Inventories.")
public void onSuggestCommand(@NotNull CommandSender sender) {
public void onSuggestCommand(@NotNull CommandSender sender,
@NotNull CommandHelp help) {
suggestDownload(
sender,
"Multiverse-Inventories",
@ -54,9 +68,9 @@ public class SubModulesCommand {
}
private static void suggestDownload(@NotNull CommandSender sender,
@NotNull String pluginName,
@NotNull ColourAlternator colours,
@NotNull String downloadLink) {
@NotNull String pluginName,
@NotNull ColourAlternator colours,
@NotNull String downloadLink) {
sender.sendMessage(colours.getColorThis() + pluginName + ChatColor.WHITE +
" is not installed on this server. You can learn more and download it at:");