diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java new file mode 100644 index 00000000..ea3474dd --- /dev/null +++ b/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java @@ -0,0 +1,37 @@ +package org.mvplugins.multiverse.core.commands; + +import co.aikar.commands.BukkitCommandIssuer; +import co.aikar.commands.MessageType; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Subcommand; +import jakarta.inject.Inject; +import org.jetbrains.annotations.NotNull; +import org.jvnet.hk2.annotations.Service; +import org.mvplugins.multiverse.core.MultiverseCore; +import org.mvplugins.multiverse.core.commandtools.MVCommandManager; +import org.mvplugins.multiverse.core.commandtools.MultiverseCommand; +import org.mvplugins.multiverse.core.utils.MVCorei18n; + +@Service +@CommandAlias("mv") +class VersionCommand extends MultiverseCommand { + + private final MultiverseCore plugin; + + @Inject + VersionCommand(@NotNull MVCommandManager commandManager, MultiverseCore plugin) { + super(commandManager); + this.plugin = plugin; + } + + @Subcommand("version") + @CommandPermission("multiverse.core.version") + @Description("{@@mv-core.version.description}") + void versionCommand(BukkitCommandIssuer issuer) { + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_MV, "{version}", plugin.getDescription().getVersion()); + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_AUTHORS, "{authors}", String.join(", ", plugin.getDescription().getAuthors())); + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_SECRETCODE); // An in joke I don't get... + } +} diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java b/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java index 9e11b39b..8d089b98 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java @@ -108,6 +108,10 @@ public enum MVCorei18n implements MessageKeyProvider { WHO_FLAGS_DESCRIPTION, WHO_EMPTY, + // version command + VERSION_MV, + VERSION_AUTHORS, + VERSION_SECRETCODE, // debug command DEBUG_INFO_OFF, diff --git a/src/main/resources/multiverse-core_en.properties b/src/main/resources/multiverse-core_en.properties index 0130a8e9..8e2f4b5a 100644 --- a/src/main/resources/multiverse-core_en.properties +++ b/src/main/resources/multiverse-core_en.properties @@ -147,6 +147,12 @@ mv-core.who.world.description=Name of the world you want to list players in mv-core.who.flags.description=Filter - only shows entries matching this. Page - the page to show mv-core.who.empty=&rEmpty +# /mv version +mv-core.version.description=Displays version and authors +mv-core.version.mv=Multiverse Core Version &fv{version} +mv-core.version.authors=Multiverse Core Authors &f{authors} +mv-core.version.secretcode=Special Code: &fFRN002 + # commands error mv-core.commands.error.playersonly=&cThis command can only be used by players mv-core.commands.error.multiverseworldonly=&cThis can only be used in multiverse worlds diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8a26e307..f4bc2d69 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Multiverse-Core main: org.mvplugins.multiverse.core.MultiverseCore -authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--'] +authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--', 'benwoo1110', 'Zax71'] website: 'https://dev.bukkit.org/projects/multiverse-core' softdepend: ['Vault', 'PlaceholderAPI'] api-version: 1.13