Merge branch 'MV5' into ben/mv5/teleporter

# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/commands/TeleportCommand.java
This commit is contained in:
Ben Woo 2023-09-12 17:25:50 +08:00
commit 9ddfa59712
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
23 changed files with 332 additions and 322 deletions

View File

@ -1,6 +1,5 @@
package org.mvplugins.multiverse.core.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
@ -12,6 +11,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
@ -20,12 +20,12 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
@Service
@CommandAlias("mv")
public class CheckCommand extends MultiverseCommand {
class CheckCommand extends MultiverseCommand {
private final DestinationsProvider destinationsProvider;
@Inject
public CheckCommand(@NotNull MVCommandManager commandManager, @NotNull DestinationsProvider destinationsProvider) {
CheckCommand(@NotNull MVCommandManager commandManager, @NotNull DestinationsProvider destinationsProvider) {
super(commandManager);
this.destinationsProvider = destinationsProvider;
}
@ -35,16 +35,16 @@ public class CheckCommand extends MultiverseCommand {
@CommandCompletion("@players @destinations|@mvworlds")
@Syntax("<player> <destination>")
@Description("{@@mv-core.check.description}")
public void onCheckCommand(BukkitCommandIssuer issuer,
void onCheckCommand(
MVCommandIssuer issuer,
@Syntax("<player>")
@Description("{@@mv-core.check.player.description}")
Player player,
@Syntax("<player>")
@Description("{@@mv-core.check.player.description}")
Player player,
@Syntax("<destination>")
@Description("{@@mv-core.check.destination.description}")
ParsedDestination<?> destination
) {
@Syntax("<destination>")
@Description("{@@mv-core.check.destination.description}")
ParsedDestination<?> destination) {
issuer.sendInfo(MVCorei18n.CHECK_CHECKING,
"{player}", player.getName(),
"{destination}", destination.toString());

View File

@ -16,7 +16,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlagGroup;
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
import org.mvplugins.multiverse.core.utils.MVCorei18n;
import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
@ -25,31 +24,31 @@ import org.mvplugins.multiverse.core.worldnew.options.CloneWorldOptions;
@Service
@CommandAlias("mv")
public class CloneCommand extends MultiverseCommand {
class CloneCommand extends MultiverseCommand {
private final WorldManager worldManager;
private final CommandFlag RESET_WORLD_CONFIG_FLAG = flag(CommandFlag.builder("--reset-world-config")
.addAlias("-wc")
.build());
private final CommandFlag RESET_GAMERULES_FLAG = flag(CommandFlag.builder("--reset-gamerules")
.addAlias("-gm")
.build());
private final CommandFlag RESET_WORLD_BORDER_FLAG = flag(CommandFlag.builder("--reset-world-border")
.addAlias("-wb")
.build());
@Inject
public CloneCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
CloneCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvclone")
.add(CommandFlag.builder("--reset-world-config")
.addAlias("-wc")
.build())
.add(CommandFlag.builder("--reset-gamerules")
.addAlias("-gm")
.build())
.add(CommandFlag.builder("--reset-world-border")
.addAlias("-wb")
.build())
.build());
}
@Subcommand("clone")
@CommandPermission("multiverse.core.clone")
@CommandCompletion("@mvworlds:scope=both @empty")
@CommandCompletion("@mvworlds:scope=loaded @empty @flags:groupName=mvclonecommand")
@Syntax("<world> <new world name>")
@Description("{@@mv-core.clone.description}")
void onCloneCommand(
@ -71,9 +70,9 @@ public class CloneCommand extends MultiverseCommand {
issuer.sendInfo(MVCorei18n.CLONE_CLONING, "{world}", world.getName(), "{newworld}", newWorldName);
CloneWorldOptions cloneWorldOptions = CloneWorldOptions.fromTo(world, newWorldName)
.keepWorldConfig(!parsedFlags.hasFlag("--reset-world-config"))
.keepGameRule(!parsedFlags.hasFlag("--reset-gamerules"))
.keepWorldBorder(!parsedFlags.hasFlag("--reset-world-border"));
.keepWorldConfig(!parsedFlags.hasFlag(RESET_WORLD_CONFIG_FLAG))
.keepGameRule(!parsedFlags.hasFlag(RESET_GAMERULES_FLAG))
.keepWorldBorder(!parsedFlags.hasFlag(RESET_WORLD_BORDER_FLAG));
worldManager.cloneWorld(cloneWorldOptions)
.onSuccess(newWorld -> {
Logging.fine("World clone success: " + newWorld);

View File

@ -5,7 +5,6 @@ import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import io.vavr.control.Option;
@ -22,12 +21,12 @@ import org.mvplugins.multiverse.core.exceptions.MultiverseException;
@Service
@CommandAlias("mv")
public class ConfigCommand extends MultiverseCommand {
class ConfigCommand extends MultiverseCommand {
private final MVCoreConfig config;
@Inject
public ConfigCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
ConfigCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
super(commandManager);
this.config = config;
}
@ -37,18 +36,17 @@ public class ConfigCommand extends MultiverseCommand {
@CommandCompletion("@mvconfigs")
@Syntax("<name> [new-value]")
@Description("") // TODO: Description
public void onConfigCommand(MVCommandIssuer issuer,
void onConfigCommand(
MVCommandIssuer issuer,
@Syntax("<name>")
@Description("") // TODO: Description
String name,
@Syntax("<name>")
@Description("") // TODO: Description
String name,
@Optional
@Single
@Syntax("[new-value]")
@Description("") // TODO: Description
MVConfigValue value
) {
@Optional
@Syntax("[new-value]")
@Description("") // TODO: Description
MVConfigValue value) {
if (value == null) {
showConfigValue(issuer, name);
return;

View File

@ -14,17 +14,17 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
@Service
@CommandAlias("mv")
public class ConfirmCommand extends MultiverseCommand {
class ConfirmCommand extends MultiverseCommand {
@Inject
public ConfirmCommand(@NotNull MVCommandManager commandManager) {
ConfirmCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@Subcommand("confirm")
@CommandPermission("multiverse.core.confirm")
@Description("{@@mv-core.confirm.description}")
public void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
this.commandManager.getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
}
}

View File

@ -19,15 +19,14 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
@Service
@CommandAlias("mv")
public class CoordinatesCommand extends MultiverseCommand {
class CoordinatesCommand extends MultiverseCommand {
private final LocationManipulation locationManipulation;
@Inject
public CoordinatesCommand(
CoordinatesCommand(
@NotNull MVCommandManager commandManager,
@NotNull LocationManipulation locationManipulation
) {
@NotNull LocationManipulation locationManipulation) {
super(commandManager);
this.locationManipulation = locationManipulation;
}
@ -35,14 +34,14 @@ public class CoordinatesCommand extends MultiverseCommand {
@Subcommand("coordinates|coords|coord|co")
@CommandPermission("multiverse.core.coord")
@Description("{@@mv-core.coordinates.description}")
public void onCoordinatesCommand(BukkitCommandIssuer issuer,
void onCoordinatesCommand(
BukkitCommandIssuer issuer,
@Flags("resolve=issuerOnly")
Player player,
@Flags("resolve=issuerOnly")
Player player,
@Flags("resolve=issuerOnly")
LoadedMultiverseWorld world
) {
@Flags("resolve=issuerOnly")
LoadedMultiverseWorld world) {
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_TITLE);
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_WORLD, "{world}", world.getName());
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_ALIAS, "{alias}", world.getAlias());

View File

@ -21,7 +21,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlagGroup;
import org.mvplugins.multiverse.core.commandtools.flags.CommandValueFlag;
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
import org.mvplugins.multiverse.core.utils.MVCorei18n;
@ -31,78 +30,91 @@ import org.mvplugins.multiverse.core.worldnew.options.CreateWorldOptions;
@Service
@CommandAlias("mv")
public class CreateCommand extends MultiverseCommand {
class CreateCommand extends MultiverseCommand {
private final WorldManager worldManager;
private GeneratorProvider generatorProvider;
private final CommandValueFlag<String> SEED_FLAG = flag(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion(input -> Collections.singleton(String.valueOf(new Random().nextLong())))
.build());
private final CommandValueFlag<String> GENERATOR_FLAG = flag(CommandValueFlag
.builder("--generator", String.class)
.addAlias("-g")
.completion(input -> generatorProvider.suggestGeneratorString(input))
.build());
private final CommandValueFlag<WorldType> WORLD_TYPE_FLAG = flag(CommandValueFlag
.enumBuilder("--world-type", WorldType.class)
.addAlias("-t")
.build());
private final CommandFlag NO_ADJUST_SPAWN_FLAG = flag(CommandFlag.builder("--no-adjust-spawn")
.addAlias("-n")
.build());
private final CommandFlag NO_STRUCTURES_FLAG = flag(CommandFlag.builder("--no-structures")
.addAlias("-a")
.build());
@Inject
public CreateCommand(
CreateCommand(
@NotNull MVCommandManager commandManager,
@NotNull WorldManager worldManager,
@NotNull GeneratorProvider generatorProvider
) {
@NotNull GeneratorProvider generatorProvider) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvcreate")
.add(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion((input) -> Collections.singleton(String.valueOf(new Random().nextLong())))
.build())
.add(CommandValueFlag.builder("--generator", String.class)
.addAlias("-g")
.completion(generatorProvider::suggestGeneratorString)
.build())
.add(CommandValueFlag.enumBuilder("--world-type", WorldType.class)
.addAlias("-t")
.build())
.add(CommandFlag.builder("--no-adjust-spawn")
.addAlias("-n")
.build())
.add(CommandFlag.builder("--no-structures")
.addAlias("-a")
.build())
.build());
this.generatorProvider = generatorProvider;
}
@Subcommand("create")
@CommandPermission("multiverse.core.create")
@CommandCompletion("@empty @flags:groupName=mvcreate")
@CommandCompletion("@empty @flags:groupName=mvcreatecommand")
@Syntax("<name> <environment> --seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
@Description("{@@mv-core.create.description}")
public void onCreateCommand(MVCommandIssuer issuer,
void onCreateCommand(
MVCommandIssuer issuer,
@Syntax("<name>")
@Description("{@@mv-core.create.name.description}")
String worldName,
@Syntax("<name>")
@Description("{@@mv-core.create.name.description}")
String worldName,
@Syntax("<environment>")
@Description("{@@mv-core.create.environment.description}")
World.Environment environment,
@Syntax("<environment>")
@Description("{@@mv-core.create.environment.description}")
World.Environment environment,
@Optional
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
@Description("{@@mv-core.create.flags.description}")
String[] flags) {
@Optional
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
@Description("{@@mv-core.create.flags.description}")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES, "{worldName}", worldName);
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT, "{environment}", environment.name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED, "{seed}", parsedFlags.flagValue("--seed", "RANDOM", String.class));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_WORLDTYPE, "{worldType}", parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class).name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ADJUSTSPAWN, "{adjustSpawn}", String.valueOf(!parsedFlags.hasFlag("--no-adjust-spawn")));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_GENERATOR, "{generator}", parsedFlags.flagValue("--generator", "", String.class));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_STRUCTURES, "{structures}", String.valueOf(!parsedFlags.hasFlag("--no-structures")));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES,
"{worldName}", worldName);
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT,
"{environment}", environment.name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED,
"{seed}", parsedFlags.flagValue(SEED_FLAG, "RANDOM"));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_WORLDTYPE,
"{worldType}", parsedFlags.flagValue(WORLD_TYPE_FLAG, WorldType.NORMAL).name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ADJUSTSPAWN,
"{adjustSpawn}", String.valueOf(!parsedFlags.hasFlag(NO_ADJUST_SPAWN_FLAG)));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_GENERATOR,
"{generator}", parsedFlags.flagValue(GENERATOR_FLAG, ""));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_STRUCTURES,
"{structures}", String.valueOf(!parsedFlags.hasFlag(NO_STRUCTURES_FLAG)));
issuer.sendInfo(MVCorei18n.CREATE_LOADING);
worldManager.createWorld(CreateWorldOptions.worldName(worldName)
.environment(environment)
.seed(parsedFlags.flagValue("--seed", String.class))
.worldType(parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class))
.useSpawnAdjust(!parsedFlags.hasFlag("--no-adjust-spawn"))
.generator(parsedFlags.flagValue("--generator", "", String.class))
.generateStructures(!parsedFlags.hasFlag("--no-structures")))
.seed(parsedFlags.flagValue(SEED_FLAG))
.worldType(parsedFlags.flagValue(WORLD_TYPE_FLAG, WorldType.NORMAL))
.useSpawnAdjust(!parsedFlags.hasFlag(NO_ADJUST_SPAWN_FLAG))
.generator(parsedFlags.flagValue(GENERATOR_FLAG, ""))
.generateStructures(!parsedFlags.hasFlag(NO_STRUCTURES_FLAG)))
.onSuccess(newWorld -> {
Logging.fine("World create success: " + newWorld);
issuer.sendInfo(MVCorei18n.CREATE_SUCCESS, "{world}", newWorld.getName());

View File

@ -19,12 +19,12 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
@Service
@CommandAlias("mv")
public class DebugCommand extends MultiverseCommand {
class DebugCommand extends MultiverseCommand {
private final MVCoreConfig config;
@Inject
public DebugCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
DebugCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
super(commandManager);
this.config = config;
}
@ -32,7 +32,7 @@ public class DebugCommand extends MultiverseCommand {
@Subcommand("debug")
@CommandPermission("multiverse.core.debug")
@Description("{@@mv-core.debug.info.description}")
public void onShowDebugCommand(BukkitCommandIssuer issuer) {
void onShowDebugCommand(BukkitCommandIssuer issuer) {
this.displayDebugMode(issuer);
}
@ -41,11 +41,12 @@ public class DebugCommand extends MultiverseCommand {
@CommandCompletion("@range:3")
@Syntax("<{@@mv-core.debug.change.syntax}>")
@Description("{@@mv-core.debug.change.description}")
public void onChangeDebugCommand(BukkitCommandIssuer issuer,
void onChangeDebugCommand(
BukkitCommandIssuer issuer,
@Syntax("<{@@mv-core.debug.change.syntax}>")
@Description("{@@mv-core.debug.change.level.description}")
int level) {
@Syntax("<{@@mv-core.debug.change.syntax}>")
@Description("{@@mv-core.debug.change.level.description}")
int level) {
config.setGlobalDebug(level);
config.save();

View File

@ -23,12 +23,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
@Service
@CommandAlias("mv")
public class DeleteCommand extends MultiverseCommand {
class DeleteCommand extends MultiverseCommand {
private final WorldManager worldManager;
@Inject
public DeleteCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
DeleteCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@ -38,14 +38,14 @@ public class DeleteCommand extends MultiverseCommand {
@CommandCompletion("@mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.delete.description}")
public void onDeleteCommand(MVCommandIssuer issuer,
void onDeleteCommand(
MVCommandIssuer issuer,
@Single
@Conditions("worldname:scope=both")
@Syntax("<world>")
@Description("The world you want to delete.")
String worldName
) {
@Single
@Conditions("worldname:scope=both")
@Syntax("<world>")
@Description("The world you want to delete.")
String worldName) {
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
@ -58,12 +58,7 @@ public class DeleteCommand extends MultiverseCommand {
Logging.fine("World delete failure: " + failure);
issuer.sendError(failure.getFailureMessage());
});
},
this.commandManager.formatMessage(
issuer,
MessageType.INFO,
MVCorei18n.DELETE_PROMPT,
"{world}", worldName)
));
}, this.commandManager.formatMessage(
issuer, MessageType.INFO, MVCorei18n.DELETE_PROMPT, "{world}", worldName)));
}
}

View File

@ -43,30 +43,33 @@ import static org.mvplugins.multiverse.core.utils.file.FileUtils.getServerProper
@Service
@CommandAlias("mv")
public class DumpsCommand extends MultiverseCommand {
class DumpsCommand extends MultiverseCommand {
private final MultiverseCore plugin;
private final WorldManager worldManager;
private final CommandValueFlag<LogsTypeOption> LOGS_FLAG = flag(CommandValueFlag
.enumBuilder("--logs", LogsTypeOption.class)
.addAlias("-l")
.build());
private final CommandValueFlag<ServiceTypeOption> UPLOAD_FLAG = flag(CommandValueFlag
.enumBuilder("--upload", ServiceTypeOption.class)
.addAlias("-u")
.build());
// Does not upload logs or plugin list (except if --logs mclogs is there)
private final CommandFlag PARANOID_FLAG = flag(CommandFlag.builder("--paranoid")
.addAlias("-p")
.build());
@Inject
public DumpsCommand(@NotNull MVCommandManager commandManager,
DumpsCommand(@NotNull MVCommandManager commandManager,
@NotNull MultiverseCore plugin,
@NotNull WorldManager worldManager) {
super(commandManager);
this.plugin = plugin;
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvdumps")
.add(CommandValueFlag.enumBuilder("--logs", LogsTypeOption.class)
.addAlias("-l")
.build())
.add(CommandValueFlag.enumBuilder("--upload", ServiceTypeOption.class)
.addAlias("-u")
.build())
.add(CommandFlag.builder("--paranoid")// Does not upload logs or plugin list (except if --logs mclogs is there)
.addAlias("-p")
.build())
.build());
}
private enum ServiceTypeOption {
@ -81,21 +84,21 @@ public class DumpsCommand extends MultiverseCommand {
@Subcommand("dumps")
@CommandPermission("multiverse.core.dumps")
@CommandCompletion("@flags:groupName=mvdumps")
@CommandCompletion("@flags:groupName=mvdumpscommand")
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
@Description("{@@mv-core.dumps.description}")
public void onDumpsCommand(CommandIssuer issuer,
void onDumpsCommand(
CommandIssuer issuer,
@Optional
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
String[] flags
) {
@Optional
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
String[] flags) {
final ParsedCommandFlags parsedFlags = parseFlags(flags);
// Grab all our flags
final boolean paranoid = parsedFlags.hasFlag("--paranoid");
final LogsTypeOption logsType = parsedFlags.flagValue("--logs", LogsTypeOption.MCLOGS, LogsTypeOption.class);
final ServiceTypeOption servicesType = parsedFlags.flagValue("--upload", ServiceTypeOption.PASTEGG, ServiceTypeOption.class);
final boolean paranoid = parsedFlags.hasFlag(PARANOID_FLAG);
final LogsTypeOption logsType = parsedFlags.flagValue(LOGS_FLAG, LogsTypeOption.MCLOGS);
final ServiceTypeOption servicesType = parsedFlags.flagValue(UPLOAD_FLAG, ServiceTypeOption.PASTEGG);
// Initialise and add info to the debug event
MVVersionEvent versionEvent = new MVVersionEvent();
@ -119,8 +122,7 @@ public class DumpsCommand extends MultiverseCommand {
switch (logsType) {
case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
"{service}", "Logs",
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null)
);
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null));
case APPEND -> versionEvent.putDetailedVersionInfo("latest.log", getLogs());
}
}
@ -132,13 +134,10 @@ public class DumpsCommand extends MultiverseCommand {
switch (servicesType) {
case PASTEGG -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
"{service}", "paste.gg",
"{link}", postToService(PasteServiceType.PASTEGG, true, null, files)
);
"{link}", postToService(PasteServiceType.PASTEGG, true, null, files));
case PASTESDEV -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
"{service}", "pastes.dev",
"{link}", postToService(PasteServiceType.PASTESDEV, true, null, files)
);
"{link}", postToService(PasteServiceType.PASTESDEV, true, null, files));
}
}
@ -149,6 +148,7 @@ public class DumpsCommand extends MultiverseCommand {
}
/**
* Get the contents of the latest.log file
*
* @return A string containing the latest.log file
*/
@ -222,7 +222,8 @@ public class DumpsCommand extends MultiverseCommand {
}
/**
* Turns a list of files in to a string containing askii art
* Turns a list of files in to a string containing askii art.
*
* @param files Map of filenames/contents
* @return The askii art
*/

View File

@ -22,10 +22,10 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
@Service
@CommandAlias("mv")
public class GameruleCommand extends MultiverseCommand {
class GameruleCommand extends MultiverseCommand {
@Inject
public GameruleCommand(@NotNull MVCommandManager commandManager) {
GameruleCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@ -34,24 +34,24 @@ public class GameruleCommand extends MultiverseCommand {
@CommandCompletion("@gamerules true|false|@range:1-10 @mvworlds:multiple|*")
@Syntax("<Gamerule> <Gamerule value> [World or *]")
@Description("{@@mv-core.gamerule.description}")
public void onGameruleCommand(BukkitCommandIssuer issuer,
void onGameruleCommand(
BukkitCommandIssuer issuer,
@Syntax("<Gamerule>")
@Description("{@@mv-core.gamerule.gamerule.description}")
GameRule gamerule,
@Syntax("<Gamerule>")
@Description("{@@mv-core.gamerule.gamerule.description}")
GameRule gamerule,
@Syntax("<Value>")
@Description("{@@mv-core.gamerule.value.description}")
GameRuleValue gameRuleValue,
@Syntax("<Value>")
@Description("{@@mv-core.gamerule.value.description}")
GameRuleValue gameRuleValue,
@Flags("resolve=issuerAware")
@Syntax("[World or *]")
@Description("{@@mv-core.gamerule.world.description}")
LoadedMultiverseWorld[] worlds
) {
@Flags("resolve=issuerAware")
@Syntax("[World or *]")
@Description("{@@mv-core.gamerule.world.description}")
LoadedMultiverseWorld[] worlds) {
Object value = gameRuleValue.getValue();
boolean success = true;
for(LoadedMultiverseWorld world : worlds) {
for (LoadedMultiverseWorld world : worlds) {
// Set gamerules and add false to list if it fails
World bukkitWorld = world.getBukkitWorld().getOrNull();
if (bukkitWorld == null || !bukkitWorld.setGameRule(gamerule, value)) {
@ -70,8 +70,7 @@ public class GameruleCommand extends MultiverseCommand {
"{gamerule}", gamerule.getName(),
"{value}", value.toString(),
"{world}", worlds[0].getName());
}
else if (worlds.length > 1) {
} else if (worlds.length > 1) {
issuer.sendInfo(MVCorei18n.GAMERULE_SUCCESS_MULTIPLE,
"{gamerule}", gamerule.getName(),
"{value}", value.toString(),

View File

@ -40,7 +40,7 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
*/
@Service
@CommandAlias("mv")
public class GamerulesCommand extends MultiverseCommand {
class GamerulesCommand extends MultiverseCommand {
private final CommandValueFlag<Integer> PAGE_FLAG = flag(CommandValueFlag
.builder("--page", Integer.class)
@ -76,7 +76,7 @@ public class GamerulesCommand extends MultiverseCommand {
@CommandCompletion("@mvworlds|@flags:groupName=mvgamerulescommand @flags:groupName=mvgamerulescommand")
@Syntax("[world] [--page <page>] [--filter <filter>]")
@Description("{@@mv-core.gamerules.description}")
public void onGamerulesCommand(
void onGamerulesCommand(
@NotNull MVCommandIssuer issuer,
@Flags("resolve=issuerAware")
@ -87,8 +87,7 @@ public class GamerulesCommand extends MultiverseCommand {
@Optional
@Syntax("[--page <page>] [--filter <filter>]")
@Description("{@@mv-core.gamerules.description.page}")
String[] flags
) {
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
ContentDisplay.create()

View File

@ -11,6 +11,7 @@ import co.aikar.commands.annotation.Syntax;
import com.dumptruckman.minecraft.util.Logging;
import jakarta.inject.Inject;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@ -28,58 +29,59 @@ import org.mvplugins.multiverse.core.worldnew.options.ImportWorldOptions;
@Service
@CommandAlias("mv")
public class ImportCommand extends MultiverseCommand {
class ImportCommand extends MultiverseCommand {
private final WorldManager worldManager;
private GeneratorProvider generatorProvider;
private final CommandValueFlag<String> GENERATOR_FLAG = flag(CommandValueFlag
.builder("--generator", String.class)
.addAlias("-g")
.completion(input -> generatorProvider.suggestGeneratorString(input))
.build());
private final CommandFlag NO_ADJUST_SPAWN_FLAG = flag(CommandFlag.builder("--no-adjust-spawn")
.addAlias("-n")
.build());
@Inject
public ImportCommand(
ImportCommand(
@NotNull MVCommandManager commandManager,
@NotNull WorldManager worldManager,
@NotNull GeneratorProvider generatorProvider
) {
@NotNull GeneratorProvider generatorProvider) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvimport")
.add(CommandValueFlag.builder("--generator", String.class)
.addAlias("-g")
.completion(generatorProvider::suggestGeneratorString)
.build())
.add(CommandFlag.builder("--adjust-spawn")
.addAlias("-a")
.build())
.build());
this.generatorProvider = generatorProvider;
}
@Subcommand("import")
@CommandPermission("multiverse.core.import")
@CommandCompletion("@mvworlds:scope=potential @flags:groupName=mvimport")
@CommandCompletion("@mvworlds:scope=potential @flags:groupName=mvimportcommand")
@Syntax("<name> <env> --generator [generator[:id]] --adjust-spawn")
@Description("{@@mv-core.import.description")
public void onImportCommand(MVCommandIssuer issuer,
void onImportCommand(
MVCommandIssuer issuer,
@Conditions("worldname:scope=new")
@Syntax("<name>")
@Description("{@@mv-core.import.name.description}")
String worldName,
@Conditions("worldname:scope=new")
@Syntax("<name>")
@Description("{@@mv-core.import.name.description}")
String worldName,
@Syntax("<env>")
@Description("{@@mv-core.import.env.description}")
World.Environment environment,
@Optional
@Syntax("--generator [generator[:id]] --adjust-spawn")
@Description("{@@mv-core.import.other.description}")
String[] flags) {
@Syntax("<env>")
@Description("{@@mv-core.import.env.description}")
World.Environment environment,
@Optional
@Syntax("--generator [generator[:id]] --adjust-spawn")
@Description("{@@mv-core.import.other.description}")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
issuer.sendInfo(MVCorei18n.IMPORT_IMPORTING, "{world}", worldName);
worldManager.importWorld(ImportWorldOptions.worldName(worldName)
.environment(environment)
.generator(parsedFlags.flagValue("--generator", String.class))
.useSpawnAdjust(parsedFlags.hasFlag("--adjust-spawn")))
.generator(parsedFlags.flagValue(GENERATOR_FLAG, String.class))
.useSpawnAdjust(!parsedFlags.hasFlag(NO_ADJUST_SPAWN_FLAG)))
.onSuccess(newWorld -> {
Logging.fine("World import success: " + newWorld);
issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS, "{world}", newWorld.getName());

View File

@ -35,68 +35,68 @@ import org.mvplugins.multiverse.core.worldnew.entrycheck.WorldEntryCheckerProvid
@Service
@CommandAlias("mv")
public class ListCommand extends MultiverseCommand {
class ListCommand extends MultiverseCommand {
private final WorldManager worldManager;
private final WorldEntryCheckerProvider worldEntryCheckerProvider;
private final CommandValueFlag<Integer> PAGE_FLAG = flag(CommandValueFlag
.builder("--page", Integer.class)
.addAlias("-p")
.context(value -> {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new InvalidCommandArgument("Invalid page number: " + value);
}
})
.build());
private final CommandValueFlag<ContentFilter> FILTER_FLAG = flag(CommandValueFlag
.builder("--filter", ContentFilter.class)
.addAlias("-f")
.context(value -> {
try {
return RegexContentFilter.fromString(value);
} catch (IllegalArgumentException e) {
throw new InvalidCommandArgument("Invalid filter: " + value);
}
})
.build());
@Inject
public ListCommand(
ListCommand(
@NotNull MVCommandManager commandManager,
@NotNull WorldManager worldManager,
@NotNull WorldEntryCheckerProvider worldEntryCheckerProvider
) {
@NotNull WorldEntryCheckerProvider worldEntryCheckerProvider) {
super(commandManager);
this.worldManager = worldManager;
this.worldEntryCheckerProvider = worldEntryCheckerProvider;
registerFlagGroup(CommandFlagGroup.builder("mvlist")
.add(CommandValueFlag.builder("--filter", ContentFilter.class)
.addAlias("-f")
.context((value) -> {
try {
return RegexContentFilter.fromString(value);
} catch (IllegalArgumentException e) {
throw new InvalidCommandArgument("Invalid filter: " + value);
}
})
.build())
.add(CommandValueFlag.builder("--page", Integer.class)
.addAlias("-p")
.context((value) -> {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new InvalidCommandArgument("Invalid page number: " + value);
}
})
.build())
.build());
}
@Subcommand("list")
@CommandPermission("multiverse.core.list.worlds")
@CommandCompletion("@flags:groupName=mvlist")
@CommandCompletion("@flags:groupName=mvlistcommand")
@Syntax("--filter [filter] --page [page]")
@Description("Displays a listing of all worlds that you can enter.")
public void onListCommand(MVCommandIssuer issuer,
public void onListCommand(
MVCommandIssuer issuer,
@Syntax("--filter [filter] --page [page]")
@Description("Filters the list of worlds by the given regex and displays the given page.")
String[] flags
) {
@Syntax("[--filter <filter>] [--page <page>]")
@Description("Filters the list of worlds by the given regex and displays the given page.")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
ContentDisplay.create()
.addContent(ListContentProvider.forContent(getListContents(issuer)))
.withSendHandler(PagedSendHandler.create()
.withHeader("%s====[ Multiverse World List ]====", ChatColor.GOLD)
.withTargetPage(parsedFlags.flagValue("--page", 1, Integer.class))
.withFilter(parsedFlags.flagValue("--filter", DefaultContentFilter.get(), ContentFilter.class)))
.withTargetPage(parsedFlags.flagValue(PAGE_FLAG, 1))
.withFilter(parsedFlags.flagValue(FILTER_FLAG, DefaultContentFilter.get())))
.send(issuer);
}
private List<String> getListContents(MVCommandIssuer issuer) {
List<String> worldList = new ArrayList<>();
List<String> worldList = new ArrayList<>();
WorldEntryChecker worldEntryChecker = worldEntryCheckerProvider.forSender(issuer.getIssuer());
worldManager.getLoadedWorlds().stream()

View File

@ -21,12 +21,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
@Service
@CommandAlias("mv")
public class LoadCommand extends MultiverseCommand {
class LoadCommand extends MultiverseCommand {
private final WorldManager worldManager;
@Inject
public LoadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
LoadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@ -36,14 +36,14 @@ public class LoadCommand extends MultiverseCommand {
@CommandCompletion("@mvworlds:scope=unloaded")
@Syntax("<world>")
@Description("{@@mv-core.load.description}")
public void onLoadCommand(MVCommandIssuer issuer,
void onLoadCommand(
MVCommandIssuer issuer,
@Single
@Conditions("worldname:scope=unloaded")
@Syntax("<world>")
@Description("{@@mv-core.load.world.description}")
String worldName
) {
@Single
@Conditions("worldname:scope=unloaded")
@Syntax("<world>")
@Description("{@@mv-core.load.world.description}")
String worldName) {
issuer.sendInfo(MVCorei18n.LOAD_LOADING, "{world}", worldName);
worldManager.loadWorld(worldName)
.onSuccess(newWorld -> {

View File

@ -20,7 +20,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlagGroup;
import org.mvplugins.multiverse.core.commandtools.flags.CommandValueFlag;
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
import org.mvplugins.multiverse.core.commandtools.queue.QueuedCommand;
@ -31,49 +30,49 @@ import org.mvplugins.multiverse.core.worldnew.options.RegenWorldOptions;
@Service
@CommandAlias("mv")
public class RegenCommand extends MultiverseCommand {
class RegenCommand extends MultiverseCommand {
private final WorldManager worldManager;
private final CommandValueFlag<String> SEED_FLAG = flag(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion(input -> Collections.singleton(String.valueOf(new Random().nextLong())))
.build());
private final CommandFlag RESET_WORLD_CONFIG_FLAG = flag(CommandFlag.builder("--reset-world-config")
.addAlias("-wc")
.build());
private final CommandFlag RESET_GAMERULES_FLAG = flag(CommandFlag.builder("--reset-gamerules")
.addAlias("-gm")
.build());
private final CommandFlag RESET_WORLD_BORDER_FLAG = flag(CommandFlag.builder("--reset-world-border")
.addAlias("-wb")
.build());
@Inject
public RegenCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
RegenCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvregen")
.add(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion((input) -> Collections.singleton(String.valueOf(new Random().nextLong())))
.optional()
.build())
.add(CommandFlag.builder("--reset-world-config")
.addAlias("-wc")
.build())
.add(CommandFlag.builder("--reset-gamerules")
.addAlias("-gm")
.build())
.add(CommandFlag.builder("--reset-world-border")
.addAlias("-wb")
.build())
.build());
}
@Subcommand("regen")
@CommandPermission("multiverse.core.regen")
@CommandCompletion("@mvworlds:scope=loaded @flags:groupName=mvregen")
@CommandCompletion("@mvworlds:scope=loaded @flags:groupName=mvregencommand")
@Syntax("<world> --seed [seed] --keep-gamerules")
@Description("{@@mv-core.regen.description}")
public void onRegenCommand(MVCommandIssuer issuer,
void onRegenCommand(
MVCommandIssuer issuer,
@Syntax("<world>")
@Description("{@@mv-core.regen.world.description}")
LoadedMultiverseWorld world,
@Syntax("<world>")
@Description("{@@mv-core.regen.world.description}")
LoadedMultiverseWorld world,
@Optional
@Syntax("--seed [seed] --reset-gamerules")
@Description("{@@mv-core.regen.other.description}")
String[] flags
) {
@Optional
@Syntax("--seed [seed] --reset-gamerules")
@Description("{@@mv-core.regen.other.description}")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
@ -81,11 +80,11 @@ public class RegenCommand extends MultiverseCommand {
() -> {
issuer.sendInfo(MVCorei18n.REGEN_REGENERATING, "{world}", world.getName());
worldManager.regenWorld(RegenWorldOptions.world(world)
.randomSeed(parsedFlags.hasFlag("--seed"))
.seed(parsedFlags.flagValue("--seed", String.class))
.keepWorldConfig(!parsedFlags.hasFlag("--reset-world-config"))
.keepGameRule(!parsedFlags.hasFlag("--reset-gamerules"))
.keepWorldBorder(!parsedFlags.hasFlag("--reset-world-border"))
.randomSeed(parsedFlags.hasFlag(SEED_FLAG))
.seed(parsedFlags.flagValue(SEED_FLAG))
.keepWorldConfig(!parsedFlags.hasFlag(RESET_WORLD_CONFIG_FLAG))
.keepGameRule(!parsedFlags.hasFlag(RESET_GAMERULES_FLAG))
.keepWorldBorder(!parsedFlags.hasFlag(RESET_WORLD_BORDER_FLAG))
).onSuccess(newWorld -> {
Logging.fine("World regen success: " + newWorld);
issuer.sendInfo(MVCorei18n.REGEN_SUCCESS, "{world}", newWorld.getName());
@ -95,10 +94,6 @@ public class RegenCommand extends MultiverseCommand {
});
},
this.commandManager.formatMessage(
issuer,
MessageType.INFO,
MVCorei18n.REGEN_PROMPT,
"{world}", world.getName())
));
issuer, MessageType.INFO, MVCorei18n.REGEN_PROMPT, "{world}", world.getName())));
}
}

View File

@ -23,7 +23,7 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
@Service
@CommandAlias("mv")
public class ReloadCommand extends MultiverseCommand {
class ReloadCommand extends MultiverseCommand {
private final MVCoreConfig config;
private final AnchorManager anchorManager;
@ -31,13 +31,12 @@ public class ReloadCommand extends MultiverseCommand {
private final PluginManager pluginManager;
@Inject
public ReloadCommand(
ReloadCommand(
@NotNull MVCommandManager commandManager,
@NotNull MVCoreConfig config,
@NotNull AnchorManager anchorManager,
@NotNull WorldManager worldManager,
@NotNull PluginManager pluginManager
) {
@NotNull PluginManager pluginManager) {
super(commandManager);
this.config = config;
this.anchorManager = anchorManager;
@ -48,7 +47,7 @@ public class ReloadCommand extends MultiverseCommand {
@Subcommand("reload")
@CommandPermission("multiverse.core.reload")
@Description("{@@mv-core.reload.description}")
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
issuer.sendInfo(MVCorei18n.RELOAD_RELOADING);
try {
// TODO: Make this all Try<Void>

View File

@ -21,12 +21,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
@Service
@CommandAlias("mv")
public class RemoveCommand extends MultiverseCommand {
class RemoveCommand extends MultiverseCommand {
private final WorldManager worldManager;
@Inject
public RemoveCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
RemoveCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@ -36,14 +36,14 @@ public class RemoveCommand extends MultiverseCommand {
@CommandCompletion("@mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.remove.description}")
public void onRemoveCommand(MVCommandIssuer issuer,
void onRemoveCommand(
MVCommandIssuer issuer,
@Single
@Conditions("mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.remove.world.description}")
String worldName
) {
@Single
@Conditions("mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.remove.world.description}")
String worldName) {
worldManager.removeWorld(worldName)
.onSuccess(removedWorldName -> {
Logging.fine("World remove success: " + removedWorldName);

View File

@ -14,18 +14,18 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.utils.MVCorei18n;
@Service
public class RootCommand extends MultiverseCommand {
class RootCommand extends MultiverseCommand {
private final Plugin plugin;
@Inject
public RootCommand(@NotNull MVCommandManager commandManager, @NotNull MultiverseCore plugin) {
RootCommand(@NotNull MVCommandManager commandManager, @NotNull MultiverseCore plugin) {
super(commandManager);
this.plugin = plugin;
}
@CommandAlias("mv")
public void onRootCommand(CommandIssuer issuer) {
void onRootCommand(CommandIssuer issuer) {
PluginDescriptionFile description = this.plugin.getDescription();
issuer.sendInfo(MVCorei18n.ROOT_TITLE,
"{name}", description.getName(),

View File

@ -26,13 +26,13 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
@Service
@CommandAlias("mv")
public class TeleportCommand extends MultiverseCommand {
class TeleportCommand extends MultiverseCommand {
private final CorePermissionsChecker permissionsChecker;
private final AsyncSafetyTeleporter safetyTeleporter;
@Inject
public TeleportCommand(
TeleportCommand(
@NotNull MVCommandManager commandManager,
@NotNull CorePermissionsChecker permissionsChecker,
@NotNull AsyncSafetyTeleporter safetyTeleporter) {
@ -46,7 +46,7 @@ public class TeleportCommand extends MultiverseCommand {
@CommandCompletion("@players|@mvworlds:playerOnly|@destinations:playerOnly @mvworlds|@destinations")
@Syntax("[player] <destination>")
@Description("{@@mv-core.teleport.description}")
public void onTeleportCommand(
void onTeleportCommand(
MVCommandIssuer issuer,
@Flags("resolve=issuerAware")

View File

@ -24,7 +24,7 @@ import org.mvplugins.multiverse.core.worldnew.options.UnloadWorldOptions;
@Service
@CommandAlias("mv")
public class UnloadCommand extends MultiverseCommand {
class UnloadCommand extends MultiverseCommand {
private final WorldManager worldManager;
@ -37,7 +37,7 @@ public class UnloadCommand extends MultiverseCommand {
.build());
@Inject
public UnloadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
UnloadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@ -47,7 +47,7 @@ public class UnloadCommand extends MultiverseCommand {
@CommandCompletion("@mvworlds @flags:groupName=mvunloadcommand")
@Syntax("<world>")
@Description("{@@mv-core.unload.description}")
public void onUnloadCommand(
void onUnloadCommand(
MVCommandIssuer issuer,
@Syntax("<world>")

View File

@ -17,10 +17,10 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
@Service
@CommandAlias("mv")
public class UsageCommand extends MultiverseCommand {
class UsageCommand extends MultiverseCommand {
@Inject
public UsageCommand(@NotNull MVCommandManager commandManager) {
UsageCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@ -30,7 +30,7 @@ public class UsageCommand extends MultiverseCommand {
@CommandCompletion("@commands:mv")
@Syntax("[filter] [page]")
@Description("{@@mv-core.usage.description}")
public void onUsageCommand(CommandHelp help) {
void onUsageCommand(CommandHelp help) {
if (help.getIssuer().isPlayer()) {
// Prevent flooding the chat
help.setPerPage(4);

View File

@ -263,7 +263,7 @@ public class CommandValueFlag<T> extends CommandFlag {
* @return The flag.
*/
@Override
public @NotNull CommandFlag build() {
public @NotNull CommandValueFlag<T> build() {
return new CommandValueFlag<>(key, aliases, type, optional, defaultValue, context, completion);
}
}

View File

@ -83,6 +83,17 @@ public class ParsedCommandFlags
return (T) value;
}
/**
* Get the value of a flag.
*
* @param <T> The type of the value.
* @param flag The flag to get the value of.
* @return The value of the flag, default value if flag does not exist or no value.
*/
public @Nullable <T> T flagValue(@NotNull CommandValueFlag<T> flag) {
return flagValue(flag.getKey(), flag.getType());
}
/**
* Get the value of a flag.
*