mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Merge branch 'MV5' into ben/mv5/teleporter
# Conflicts: # src/main/java/org/mvplugins/multiverse/core/commands/TeleportCommand.java
This commit is contained in:
commit
9ddfa59712
@ -1,6 +1,5 @@
|
|||||||
package org.mvplugins.multiverse.core.commands;
|
package org.mvplugins.multiverse.core.commands;
|
||||||
|
|
||||||
import co.aikar.commands.BukkitCommandIssuer;
|
|
||||||
import co.aikar.commands.annotation.CommandAlias;
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
import co.aikar.commands.annotation.CommandCompletion;
|
import co.aikar.commands.annotation.CommandCompletion;
|
||||||
import co.aikar.commands.annotation.CommandPermission;
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
@ -12,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jvnet.hk2.annotations.Service;
|
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.MVCommandManager;
|
||||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||||
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
|
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
|
||||||
@ -20,12 +20,12 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class CheckCommand extends MultiverseCommand {
|
class CheckCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final DestinationsProvider destinationsProvider;
|
private final DestinationsProvider destinationsProvider;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CheckCommand(@NotNull MVCommandManager commandManager, @NotNull DestinationsProvider destinationsProvider) {
|
CheckCommand(@NotNull MVCommandManager commandManager, @NotNull DestinationsProvider destinationsProvider) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.destinationsProvider = destinationsProvider;
|
this.destinationsProvider = destinationsProvider;
|
||||||
}
|
}
|
||||||
@ -35,16 +35,16 @@ public class CheckCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@players @destinations|@mvworlds")
|
@CommandCompletion("@players @destinations|@mvworlds")
|
||||||
@Syntax("<player> <destination>")
|
@Syntax("<player> <destination>")
|
||||||
@Description("{@@mv-core.check.description}")
|
@Description("{@@mv-core.check.description}")
|
||||||
public void onCheckCommand(BukkitCommandIssuer issuer,
|
void onCheckCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<player>")
|
@Syntax("<player>")
|
||||||
@Description("{@@mv-core.check.player.description}")
|
@Description("{@@mv-core.check.player.description}")
|
||||||
Player player,
|
Player player,
|
||||||
|
|
||||||
@Syntax("<destination>")
|
@Syntax("<destination>")
|
||||||
@Description("{@@mv-core.check.destination.description}")
|
@Description("{@@mv-core.check.destination.description}")
|
||||||
ParsedDestination<?> destination
|
ParsedDestination<?> destination) {
|
||||||
) {
|
|
||||||
issuer.sendInfo(MVCorei18n.CHECK_CHECKING,
|
issuer.sendInfo(MVCorei18n.CHECK_CHECKING,
|
||||||
"{player}", player.getName(),
|
"{player}", player.getName(),
|
||||||
"{destination}", destination.toString());
|
"{destination}", destination.toString());
|
||||||
|
@ -16,7 +16,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
|
|||||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||||
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
|
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.commandtools.flags.ParsedCommandFlags;
|
||||||
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
||||||
import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
|
import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
|
||||||
@ -25,31 +24,31 @@ import org.mvplugins.multiverse.core.worldnew.options.CloneWorldOptions;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class CloneCommand extends MultiverseCommand {
|
class CloneCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
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
|
@Inject
|
||||||
public CloneCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
CloneCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
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")
|
@Subcommand("clone")
|
||||||
@CommandPermission("multiverse.core.clone")
|
@CommandPermission("multiverse.core.clone")
|
||||||
@CommandCompletion("@mvworlds:scope=both @empty")
|
@CommandCompletion("@mvworlds:scope=loaded @empty @flags:groupName=mvclonecommand")
|
||||||
@Syntax("<world> <new world name>")
|
@Syntax("<world> <new world name>")
|
||||||
@Description("{@@mv-core.clone.description}")
|
@Description("{@@mv-core.clone.description}")
|
||||||
void onCloneCommand(
|
void onCloneCommand(
|
||||||
@ -71,9 +70,9 @@ public class CloneCommand extends MultiverseCommand {
|
|||||||
|
|
||||||
issuer.sendInfo(MVCorei18n.CLONE_CLONING, "{world}", world.getName(), "{newworld}", newWorldName);
|
issuer.sendInfo(MVCorei18n.CLONE_CLONING, "{world}", world.getName(), "{newworld}", newWorldName);
|
||||||
CloneWorldOptions cloneWorldOptions = CloneWorldOptions.fromTo(world, newWorldName)
|
CloneWorldOptions cloneWorldOptions = CloneWorldOptions.fromTo(world, newWorldName)
|
||||||
.keepWorldConfig(!parsedFlags.hasFlag("--reset-world-config"))
|
.keepWorldConfig(!parsedFlags.hasFlag(RESET_WORLD_CONFIG_FLAG))
|
||||||
.keepGameRule(!parsedFlags.hasFlag("--reset-gamerules"))
|
.keepGameRule(!parsedFlags.hasFlag(RESET_GAMERULES_FLAG))
|
||||||
.keepWorldBorder(!parsedFlags.hasFlag("--reset-world-border"));
|
.keepWorldBorder(!parsedFlags.hasFlag(RESET_WORLD_BORDER_FLAG));
|
||||||
worldManager.cloneWorld(cloneWorldOptions)
|
worldManager.cloneWorld(cloneWorldOptions)
|
||||||
.onSuccess(newWorld -> {
|
.onSuccess(newWorld -> {
|
||||||
Logging.fine("World clone success: " + newWorld);
|
Logging.fine("World clone success: " + newWorld);
|
||||||
|
@ -5,7 +5,6 @@ import co.aikar.commands.annotation.CommandCompletion;
|
|||||||
import co.aikar.commands.annotation.CommandPermission;
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
import co.aikar.commands.annotation.Description;
|
import co.aikar.commands.annotation.Description;
|
||||||
import co.aikar.commands.annotation.Optional;
|
import co.aikar.commands.annotation.Optional;
|
||||||
import co.aikar.commands.annotation.Single;
|
|
||||||
import co.aikar.commands.annotation.Subcommand;
|
import co.aikar.commands.annotation.Subcommand;
|
||||||
import co.aikar.commands.annotation.Syntax;
|
import co.aikar.commands.annotation.Syntax;
|
||||||
import io.vavr.control.Option;
|
import io.vavr.control.Option;
|
||||||
@ -22,12 +21,12 @@ import org.mvplugins.multiverse.core.exceptions.MultiverseException;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class ConfigCommand extends MultiverseCommand {
|
class ConfigCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final MVCoreConfig config;
|
private final MVCoreConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ConfigCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
|
ConfigCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
@ -37,18 +36,17 @@ public class ConfigCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvconfigs")
|
@CommandCompletion("@mvconfigs")
|
||||||
@Syntax("<name> [new-value]")
|
@Syntax("<name> [new-value]")
|
||||||
@Description("") // TODO: Description
|
@Description("") // TODO: Description
|
||||||
public void onConfigCommand(MVCommandIssuer issuer,
|
void onConfigCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<name>")
|
@Syntax("<name>")
|
||||||
@Description("") // TODO: Description
|
@Description("") // TODO: Description
|
||||||
String name,
|
String name,
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@Single
|
@Syntax("[new-value]")
|
||||||
@Syntax("[new-value]")
|
@Description("") // TODO: Description
|
||||||
@Description("") // TODO: Description
|
MVConfigValue value) {
|
||||||
MVConfigValue value
|
|
||||||
) {
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
showConfigValue(issuer, name);
|
showConfigValue(issuer, name);
|
||||||
return;
|
return;
|
||||||
|
@ -14,17 +14,17 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class ConfirmCommand extends MultiverseCommand {
|
class ConfirmCommand extends MultiverseCommand {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ConfirmCommand(@NotNull MVCommandManager commandManager) {
|
ConfirmCommand(@NotNull MVCommandManager commandManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("confirm")
|
@Subcommand("confirm")
|
||||||
@CommandPermission("multiverse.core.confirm")
|
@CommandPermission("multiverse.core.confirm")
|
||||||
@Description("{@@mv-core.confirm.description}")
|
@Description("{@@mv-core.confirm.description}")
|
||||||
public void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
|
void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
|
||||||
this.commandManager.getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
|
this.commandManager.getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,14 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class CoordinatesCommand extends MultiverseCommand {
|
class CoordinatesCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final LocationManipulation locationManipulation;
|
private final LocationManipulation locationManipulation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CoordinatesCommand(
|
CoordinatesCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull LocationManipulation locationManipulation
|
@NotNull LocationManipulation locationManipulation) {
|
||||||
) {
|
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.locationManipulation = locationManipulation;
|
this.locationManipulation = locationManipulation;
|
||||||
}
|
}
|
||||||
@ -35,14 +34,14 @@ public class CoordinatesCommand extends MultiverseCommand {
|
|||||||
@Subcommand("coordinates|coords|coord|co")
|
@Subcommand("coordinates|coords|coord|co")
|
||||||
@CommandPermission("multiverse.core.coord")
|
@CommandPermission("multiverse.core.coord")
|
||||||
@Description("{@@mv-core.coordinates.description}")
|
@Description("{@@mv-core.coordinates.description}")
|
||||||
public void onCoordinatesCommand(BukkitCommandIssuer issuer,
|
void onCoordinatesCommand(
|
||||||
|
BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Flags("resolve=issuerOnly")
|
@Flags("resolve=issuerOnly")
|
||||||
Player player,
|
Player player,
|
||||||
|
|
||||||
@Flags("resolve=issuerOnly")
|
@Flags("resolve=issuerOnly")
|
||||||
LoadedMultiverseWorld world
|
LoadedMultiverseWorld world) {
|
||||||
) {
|
|
||||||
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_TITLE);
|
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_TITLE);
|
||||||
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_WORLD, "{world}", world.getName());
|
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_WORLD, "{world}", world.getName());
|
||||||
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_ALIAS, "{alias}", world.getAlias());
|
issuer.sendInfo(MVCorei18n.COORDINATES_INFO_ALIAS, "{alias}", world.getAlias());
|
||||||
|
@ -21,7 +21,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
|
|||||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||||
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
|
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.CommandValueFlag;
|
||||||
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
|
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
|
||||||
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
||||||
@ -31,78 +30,91 @@ import org.mvplugins.multiverse.core.worldnew.options.CreateWorldOptions;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class CreateCommand extends MultiverseCommand {
|
class CreateCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
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
|
@Inject
|
||||||
public CreateCommand(
|
CreateCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull WorldManager worldManager,
|
@NotNull WorldManager worldManager,
|
||||||
@NotNull GeneratorProvider generatorProvider
|
@NotNull GeneratorProvider generatorProvider) {
|
||||||
) {
|
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
|
this.generatorProvider = generatorProvider;
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("create")
|
@Subcommand("create")
|
||||||
@CommandPermission("multiverse.core.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")
|
@Syntax("<name> <environment> --seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
|
||||||
@Description("{@@mv-core.create.description}")
|
@Description("{@@mv-core.create.description}")
|
||||||
public void onCreateCommand(MVCommandIssuer issuer,
|
void onCreateCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<name>")
|
@Syntax("<name>")
|
||||||
@Description("{@@mv-core.create.name.description}")
|
@Description("{@@mv-core.create.name.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
|
||||||
@Syntax("<environment>")
|
@Syntax("<environment>")
|
||||||
@Description("{@@mv-core.create.environment.description}")
|
@Description("{@@mv-core.create.environment.description}")
|
||||||
World.Environment environment,
|
World.Environment environment,
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
|
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
|
||||||
@Description("{@@mv-core.create.flags.description}")
|
@Description("{@@mv-core.create.flags.description}")
|
||||||
String[] flags) {
|
String[] flags) {
|
||||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
|
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES, "{worldName}", worldName);
|
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES,
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT, "{environment}", environment.name());
|
"{worldName}", worldName);
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED, "{seed}", parsedFlags.flagValue("--seed", "RANDOM", String.class));
|
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT,
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_WORLDTYPE, "{worldType}", parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class).name());
|
"{environment}", environment.name());
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ADJUSTSPAWN, "{adjustSpawn}", String.valueOf(!parsedFlags.hasFlag("--no-adjust-spawn")));
|
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED,
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_GENERATOR, "{generator}", parsedFlags.flagValue("--generator", "", String.class));
|
"{seed}", parsedFlags.flagValue(SEED_FLAG, "RANDOM"));
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_STRUCTURES, "{structures}", String.valueOf(!parsedFlags.hasFlag("--no-structures")));
|
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);
|
issuer.sendInfo(MVCorei18n.CREATE_LOADING);
|
||||||
|
|
||||||
worldManager.createWorld(CreateWorldOptions.worldName(worldName)
|
worldManager.createWorld(CreateWorldOptions.worldName(worldName)
|
||||||
.environment(environment)
|
.environment(environment)
|
||||||
.seed(parsedFlags.flagValue("--seed", String.class))
|
.seed(parsedFlags.flagValue(SEED_FLAG))
|
||||||
.worldType(parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class))
|
.worldType(parsedFlags.flagValue(WORLD_TYPE_FLAG, WorldType.NORMAL))
|
||||||
.useSpawnAdjust(!parsedFlags.hasFlag("--no-adjust-spawn"))
|
.useSpawnAdjust(!parsedFlags.hasFlag(NO_ADJUST_SPAWN_FLAG))
|
||||||
.generator(parsedFlags.flagValue("--generator", "", String.class))
|
.generator(parsedFlags.flagValue(GENERATOR_FLAG, ""))
|
||||||
.generateStructures(!parsedFlags.hasFlag("--no-structures")))
|
.generateStructures(!parsedFlags.hasFlag(NO_STRUCTURES_FLAG)))
|
||||||
.onSuccess(newWorld -> {
|
.onSuccess(newWorld -> {
|
||||||
Logging.fine("World create success: " + newWorld);
|
Logging.fine("World create success: " + newWorld);
|
||||||
issuer.sendInfo(MVCorei18n.CREATE_SUCCESS, "{world}", newWorld.getName());
|
issuer.sendInfo(MVCorei18n.CREATE_SUCCESS, "{world}", newWorld.getName());
|
||||||
|
@ -19,12 +19,12 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class DebugCommand extends MultiverseCommand {
|
class DebugCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final MVCoreConfig config;
|
private final MVCoreConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DebugCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
|
DebugCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ public class DebugCommand extends MultiverseCommand {
|
|||||||
@Subcommand("debug")
|
@Subcommand("debug")
|
||||||
@CommandPermission("multiverse.core.debug")
|
@CommandPermission("multiverse.core.debug")
|
||||||
@Description("{@@mv-core.debug.info.description}")
|
@Description("{@@mv-core.debug.info.description}")
|
||||||
public void onShowDebugCommand(BukkitCommandIssuer issuer) {
|
void onShowDebugCommand(BukkitCommandIssuer issuer) {
|
||||||
this.displayDebugMode(issuer);
|
this.displayDebugMode(issuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,11 +41,12 @@ public class DebugCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@range:3")
|
@CommandCompletion("@range:3")
|
||||||
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
||||||
@Description("{@@mv-core.debug.change.description}")
|
@Description("{@@mv-core.debug.change.description}")
|
||||||
public void onChangeDebugCommand(BukkitCommandIssuer issuer,
|
void onChangeDebugCommand(
|
||||||
|
BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
||||||
@Description("{@@mv-core.debug.change.level.description}")
|
@Description("{@@mv-core.debug.change.level.description}")
|
||||||
int level) {
|
int level) {
|
||||||
|
|
||||||
config.setGlobalDebug(level);
|
config.setGlobalDebug(level);
|
||||||
config.save();
|
config.save();
|
||||||
|
@ -23,12 +23,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class DeleteCommand extends MultiverseCommand {
|
class DeleteCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
private final WorldManager worldManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DeleteCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
DeleteCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
}
|
}
|
||||||
@ -38,14 +38,14 @@ public class DeleteCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvworlds:scope=both")
|
@CommandCompletion("@mvworlds:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.delete.description}")
|
@Description("{@@mv-core.delete.description}")
|
||||||
public void onDeleteCommand(MVCommandIssuer issuer,
|
void onDeleteCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("worldname:scope=both")
|
@Conditions("worldname:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("The world you want to delete.")
|
@Description("The world you want to delete.")
|
||||||
String worldName
|
String worldName) {
|
||||||
) {
|
|
||||||
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
|
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||||
issuer.getIssuer(),
|
issuer.getIssuer(),
|
||||||
() -> {
|
() -> {
|
||||||
@ -58,12 +58,7 @@ public class DeleteCommand extends MultiverseCommand {
|
|||||||
Logging.fine("World delete failure: " + failure);
|
Logging.fine("World delete failure: " + failure);
|
||||||
issuer.sendError(failure.getFailureMessage());
|
issuer.sendError(failure.getFailureMessage());
|
||||||
});
|
});
|
||||||
},
|
}, this.commandManager.formatMessage(
|
||||||
this.commandManager.formatMessage(
|
issuer, MessageType.INFO, MVCorei18n.DELETE_PROMPT, "{world}", worldName)));
|
||||||
issuer,
|
|
||||||
MessageType.INFO,
|
|
||||||
MVCorei18n.DELETE_PROMPT,
|
|
||||||
"{world}", worldName)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,30 +43,33 @@ import static org.mvplugins.multiverse.core.utils.file.FileUtils.getServerProper
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class DumpsCommand extends MultiverseCommand {
|
class DumpsCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final MultiverseCore plugin;
|
private final MultiverseCore plugin;
|
||||||
private final WorldManager worldManager;
|
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
|
@Inject
|
||||||
public DumpsCommand(@NotNull MVCommandManager commandManager,
|
DumpsCommand(@NotNull MVCommandManager commandManager,
|
||||||
@NotNull MultiverseCore plugin,
|
@NotNull MultiverseCore plugin,
|
||||||
@NotNull WorldManager worldManager) {
|
@NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.worldManager = worldManager;
|
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 {
|
private enum ServiceTypeOption {
|
||||||
@ -81,21 +84,21 @@ public class DumpsCommand extends MultiverseCommand {
|
|||||||
|
|
||||||
@Subcommand("dumps")
|
@Subcommand("dumps")
|
||||||
@CommandPermission("multiverse.core.dumps")
|
@CommandPermission("multiverse.core.dumps")
|
||||||
@CommandCompletion("@flags:groupName=mvdumps")
|
@CommandCompletion("@flags:groupName=mvdumpscommand")
|
||||||
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
|
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
|
||||||
@Description("{@@mv-core.dumps.description}")
|
@Description("{@@mv-core.dumps.description}")
|
||||||
public void onDumpsCommand(CommandIssuer issuer,
|
void onDumpsCommand(
|
||||||
|
CommandIssuer issuer,
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
|
@Syntax("[--logs <mclogs | append>] [--upload <pastesdev | pastegg>] [--paranoid]")
|
||||||
String[] flags
|
String[] flags) {
|
||||||
) {
|
|
||||||
final ParsedCommandFlags parsedFlags = parseFlags(flags);
|
final ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
|
|
||||||
// Grab all our flags
|
// Grab all our flags
|
||||||
final boolean paranoid = parsedFlags.hasFlag("--paranoid");
|
final boolean paranoid = parsedFlags.hasFlag(PARANOID_FLAG);
|
||||||
final LogsTypeOption logsType = parsedFlags.flagValue("--logs", LogsTypeOption.MCLOGS, LogsTypeOption.class);
|
final LogsTypeOption logsType = parsedFlags.flagValue(LOGS_FLAG, LogsTypeOption.MCLOGS);
|
||||||
final ServiceTypeOption servicesType = parsedFlags.flagValue("--upload", ServiceTypeOption.PASTEGG, ServiceTypeOption.class);
|
final ServiceTypeOption servicesType = parsedFlags.flagValue(UPLOAD_FLAG, ServiceTypeOption.PASTEGG);
|
||||||
|
|
||||||
// Initialise and add info to the debug event
|
// Initialise and add info to the debug event
|
||||||
MVVersionEvent versionEvent = new MVVersionEvent();
|
MVVersionEvent versionEvent = new MVVersionEvent();
|
||||||
@ -119,8 +122,7 @@ public class DumpsCommand extends MultiverseCommand {
|
|||||||
switch (logsType) {
|
switch (logsType) {
|
||||||
case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
|
case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
|
||||||
"{service}", "Logs",
|
"{service}", "Logs",
|
||||||
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null)
|
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null));
|
||||||
);
|
|
||||||
case APPEND -> versionEvent.putDetailedVersionInfo("latest.log", getLogs());
|
case APPEND -> versionEvent.putDetailedVersionInfo("latest.log", getLogs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,13 +134,10 @@ public class DumpsCommand extends MultiverseCommand {
|
|||||||
switch (servicesType) {
|
switch (servicesType) {
|
||||||
case PASTEGG -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
|
case PASTEGG -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
|
||||||
"{service}", "paste.gg",
|
"{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,
|
case PASTESDEV -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
|
||||||
"{service}", "pastes.dev",
|
"{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
|
* @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
|
* @param files Map of filenames/contents
|
||||||
* @return The askii art
|
* @return The askii art
|
||||||
*/
|
*/
|
||||||
|
@ -22,10 +22,10 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class GameruleCommand extends MultiverseCommand {
|
class GameruleCommand extends MultiverseCommand {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public GameruleCommand(@NotNull MVCommandManager commandManager) {
|
GameruleCommand(@NotNull MVCommandManager commandManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,24 +34,24 @@ public class GameruleCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@gamerules true|false|@range:1-10 @mvworlds:multiple|*")
|
@CommandCompletion("@gamerules true|false|@range:1-10 @mvworlds:multiple|*")
|
||||||
@Syntax("<Gamerule> <Gamerule value> [World or *]")
|
@Syntax("<Gamerule> <Gamerule value> [World or *]")
|
||||||
@Description("{@@mv-core.gamerule.description}")
|
@Description("{@@mv-core.gamerule.description}")
|
||||||
public void onGameruleCommand(BukkitCommandIssuer issuer,
|
void onGameruleCommand(
|
||||||
|
BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<Gamerule>")
|
@Syntax("<Gamerule>")
|
||||||
@Description("{@@mv-core.gamerule.gamerule.description}")
|
@Description("{@@mv-core.gamerule.gamerule.description}")
|
||||||
GameRule gamerule,
|
GameRule gamerule,
|
||||||
|
|
||||||
@Syntax("<Value>")
|
@Syntax("<Value>")
|
||||||
@Description("{@@mv-core.gamerule.value.description}")
|
@Description("{@@mv-core.gamerule.value.description}")
|
||||||
GameRuleValue gameRuleValue,
|
GameRuleValue gameRuleValue,
|
||||||
|
|
||||||
@Flags("resolve=issuerAware")
|
@Flags("resolve=issuerAware")
|
||||||
@Syntax("[World or *]")
|
@Syntax("[World or *]")
|
||||||
@Description("{@@mv-core.gamerule.world.description}")
|
@Description("{@@mv-core.gamerule.world.description}")
|
||||||
LoadedMultiverseWorld[] worlds
|
LoadedMultiverseWorld[] worlds) {
|
||||||
) {
|
|
||||||
Object value = gameRuleValue.getValue();
|
Object value = gameRuleValue.getValue();
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
for(LoadedMultiverseWorld world : worlds) {
|
for (LoadedMultiverseWorld world : worlds) {
|
||||||
// Set gamerules and add false to list if it fails
|
// Set gamerules and add false to list if it fails
|
||||||
World bukkitWorld = world.getBukkitWorld().getOrNull();
|
World bukkitWorld = world.getBukkitWorld().getOrNull();
|
||||||
if (bukkitWorld == null || !bukkitWorld.setGameRule(gamerule, value)) {
|
if (bukkitWorld == null || !bukkitWorld.setGameRule(gamerule, value)) {
|
||||||
@ -70,8 +70,7 @@ public class GameruleCommand extends MultiverseCommand {
|
|||||||
"{gamerule}", gamerule.getName(),
|
"{gamerule}", gamerule.getName(),
|
||||||
"{value}", value.toString(),
|
"{value}", value.toString(),
|
||||||
"{world}", worlds[0].getName());
|
"{world}", worlds[0].getName());
|
||||||
}
|
} else if (worlds.length > 1) {
|
||||||
else if (worlds.length > 1) {
|
|
||||||
issuer.sendInfo(MVCorei18n.GAMERULE_SUCCESS_MULTIPLE,
|
issuer.sendInfo(MVCorei18n.GAMERULE_SUCCESS_MULTIPLE,
|
||||||
"{gamerule}", gamerule.getName(),
|
"{gamerule}", gamerule.getName(),
|
||||||
"{value}", value.toString(),
|
"{value}", value.toString(),
|
||||||
|
@ -40,7 +40,7 @@ import org.mvplugins.multiverse.core.worldnew.LoadedMultiverseWorld;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class GamerulesCommand extends MultiverseCommand {
|
class GamerulesCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final CommandValueFlag<Integer> PAGE_FLAG = flag(CommandValueFlag
|
private final CommandValueFlag<Integer> PAGE_FLAG = flag(CommandValueFlag
|
||||||
.builder("--page", Integer.class)
|
.builder("--page", Integer.class)
|
||||||
@ -76,7 +76,7 @@ public class GamerulesCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvworlds|@flags:groupName=mvgamerulescommand @flags:groupName=mvgamerulescommand")
|
@CommandCompletion("@mvworlds|@flags:groupName=mvgamerulescommand @flags:groupName=mvgamerulescommand")
|
||||||
@Syntax("[world] [--page <page>] [--filter <filter>]")
|
@Syntax("[world] [--page <page>] [--filter <filter>]")
|
||||||
@Description("{@@mv-core.gamerules.description}")
|
@Description("{@@mv-core.gamerules.description}")
|
||||||
public void onGamerulesCommand(
|
void onGamerulesCommand(
|
||||||
@NotNull MVCommandIssuer issuer,
|
@NotNull MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Flags("resolve=issuerAware")
|
@Flags("resolve=issuerAware")
|
||||||
@ -87,8 +87,7 @@ public class GamerulesCommand extends MultiverseCommand {
|
|||||||
@Optional
|
@Optional
|
||||||
@Syntax("[--page <page>] [--filter <filter>]")
|
@Syntax("[--page <page>] [--filter <filter>]")
|
||||||
@Description("{@@mv-core.gamerules.description.page}")
|
@Description("{@@mv-core.gamerules.description.page}")
|
||||||
String[] flags
|
String[] flags) {
|
||||||
) {
|
|
||||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
|
|
||||||
ContentDisplay.create()
|
ContentDisplay.create()
|
||||||
|
@ -11,6 +11,7 @@ import co.aikar.commands.annotation.Syntax;
|
|||||||
import com.dumptruckman.minecraft.util.Logging;
|
import com.dumptruckman.minecraft.util.Logging;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.WorldType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jvnet.hk2.annotations.Service;
|
import org.jvnet.hk2.annotations.Service;
|
||||||
|
|
||||||
@ -28,58 +29,59 @@ import org.mvplugins.multiverse.core.worldnew.options.ImportWorldOptions;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class ImportCommand extends MultiverseCommand {
|
class ImportCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
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
|
@Inject
|
||||||
public ImportCommand(
|
ImportCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull WorldManager worldManager,
|
@NotNull WorldManager worldManager,
|
||||||
@NotNull GeneratorProvider generatorProvider
|
@NotNull GeneratorProvider generatorProvider) {
|
||||||
) {
|
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
|
this.generatorProvider = generatorProvider;
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("import")
|
@Subcommand("import")
|
||||||
@CommandPermission("multiverse.core.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")
|
@Syntax("<name> <env> --generator [generator[:id]] --adjust-spawn")
|
||||||
@Description("{@@mv-core.import.description")
|
@Description("{@@mv-core.import.description")
|
||||||
public void onImportCommand(MVCommandIssuer issuer,
|
void onImportCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Conditions("worldname:scope=new")
|
@Conditions("worldname:scope=new")
|
||||||
@Syntax("<name>")
|
@Syntax("<name>")
|
||||||
@Description("{@@mv-core.import.name.description}")
|
@Description("{@@mv-core.import.name.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
|
||||||
@Syntax("<env>")
|
@Syntax("<env>")
|
||||||
@Description("{@@mv-core.import.env.description}")
|
@Description("{@@mv-core.import.env.description}")
|
||||||
World.Environment environment,
|
World.Environment environment,
|
||||||
|
|
||||||
@Optional
|
|
||||||
@Syntax("--generator [generator[:id]] --adjust-spawn")
|
|
||||||
@Description("{@@mv-core.import.other.description}")
|
|
||||||
String[] flags) {
|
|
||||||
|
|
||||||
|
@Optional
|
||||||
|
@Syntax("--generator [generator[:id]] --adjust-spawn")
|
||||||
|
@Description("{@@mv-core.import.other.description}")
|
||||||
|
String[] flags) {
|
||||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
|
|
||||||
issuer.sendInfo(MVCorei18n.IMPORT_IMPORTING, "{world}", worldName);
|
issuer.sendInfo(MVCorei18n.IMPORT_IMPORTING, "{world}", worldName);
|
||||||
worldManager.importWorld(ImportWorldOptions.worldName(worldName)
|
worldManager.importWorld(ImportWorldOptions.worldName(worldName)
|
||||||
.environment(environment)
|
.environment(environment)
|
||||||
.generator(parsedFlags.flagValue("--generator", String.class))
|
.generator(parsedFlags.flagValue(GENERATOR_FLAG, String.class))
|
||||||
.useSpawnAdjust(parsedFlags.hasFlag("--adjust-spawn")))
|
.useSpawnAdjust(!parsedFlags.hasFlag(NO_ADJUST_SPAWN_FLAG)))
|
||||||
.onSuccess(newWorld -> {
|
.onSuccess(newWorld -> {
|
||||||
Logging.fine("World import success: " + newWorld);
|
Logging.fine("World import success: " + newWorld);
|
||||||
issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS, "{world}", newWorld.getName());
|
issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS, "{world}", newWorld.getName());
|
||||||
|
@ -35,68 +35,68 @@ import org.mvplugins.multiverse.core.worldnew.entrycheck.WorldEntryCheckerProvid
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class ListCommand extends MultiverseCommand {
|
class ListCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
private final WorldManager worldManager;
|
||||||
private final WorldEntryCheckerProvider worldEntryCheckerProvider;
|
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
|
@Inject
|
||||||
public ListCommand(
|
ListCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull WorldManager worldManager,
|
@NotNull WorldManager worldManager,
|
||||||
@NotNull WorldEntryCheckerProvider worldEntryCheckerProvider
|
@NotNull WorldEntryCheckerProvider worldEntryCheckerProvider) {
|
||||||
) {
|
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
this.worldEntryCheckerProvider = worldEntryCheckerProvider;
|
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")
|
@Subcommand("list")
|
||||||
@CommandPermission("multiverse.core.list.worlds")
|
@CommandPermission("multiverse.core.list.worlds")
|
||||||
@CommandCompletion("@flags:groupName=mvlist")
|
@CommandCompletion("@flags:groupName=mvlistcommand")
|
||||||
@Syntax("--filter [filter] --page [page]")
|
@Syntax("--filter [filter] --page [page]")
|
||||||
@Description("Displays a listing of all worlds that you can enter.")
|
@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]")
|
@Syntax("[--filter <filter>] [--page <page>]")
|
||||||
@Description("Filters the list of worlds by the given regex and displays the given page.")
|
@Description("Filters the list of worlds by the given regex and displays the given page.")
|
||||||
String[] flags
|
String[] flags) {
|
||||||
) {
|
|
||||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
ContentDisplay.create()
|
ContentDisplay.create()
|
||||||
.addContent(ListContentProvider.forContent(getListContents(issuer)))
|
.addContent(ListContentProvider.forContent(getListContents(issuer)))
|
||||||
.withSendHandler(PagedSendHandler.create()
|
.withSendHandler(PagedSendHandler.create()
|
||||||
.withHeader("%s====[ Multiverse World List ]====", ChatColor.GOLD)
|
.withHeader("%s====[ Multiverse World List ]====", ChatColor.GOLD)
|
||||||
.withTargetPage(parsedFlags.flagValue("--page", 1, Integer.class))
|
.withTargetPage(parsedFlags.flagValue(PAGE_FLAG, 1))
|
||||||
.withFilter(parsedFlags.flagValue("--filter", DefaultContentFilter.get(), ContentFilter.class)))
|
.withFilter(parsedFlags.flagValue(FILTER_FLAG, DefaultContentFilter.get())))
|
||||||
.send(issuer);
|
.send(issuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getListContents(MVCommandIssuer issuer) {
|
private List<String> getListContents(MVCommandIssuer issuer) {
|
||||||
List<String> worldList = new ArrayList<>();
|
List<String> worldList = new ArrayList<>();
|
||||||
WorldEntryChecker worldEntryChecker = worldEntryCheckerProvider.forSender(issuer.getIssuer());
|
WorldEntryChecker worldEntryChecker = worldEntryCheckerProvider.forSender(issuer.getIssuer());
|
||||||
|
|
||||||
worldManager.getLoadedWorlds().stream()
|
worldManager.getLoadedWorlds().stream()
|
||||||
|
@ -21,12 +21,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class LoadCommand extends MultiverseCommand {
|
class LoadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
private final WorldManager worldManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public LoadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
LoadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
}
|
}
|
||||||
@ -36,14 +36,14 @@ public class LoadCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvworlds:scope=unloaded")
|
@CommandCompletion("@mvworlds:scope=unloaded")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.load.description}")
|
@Description("{@@mv-core.load.description}")
|
||||||
public void onLoadCommand(MVCommandIssuer issuer,
|
void onLoadCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("worldname:scope=unloaded")
|
@Conditions("worldname:scope=unloaded")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.load.world.description}")
|
@Description("{@@mv-core.load.world.description}")
|
||||||
String worldName
|
String worldName) {
|
||||||
) {
|
|
||||||
issuer.sendInfo(MVCorei18n.LOAD_LOADING, "{world}", worldName);
|
issuer.sendInfo(MVCorei18n.LOAD_LOADING, "{world}", worldName);
|
||||||
worldManager.loadWorld(worldName)
|
worldManager.loadWorld(worldName)
|
||||||
.onSuccess(newWorld -> {
|
.onSuccess(newWorld -> {
|
||||||
|
@ -20,7 +20,6 @@ import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer;
|
|||||||
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
|
||||||
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
||||||
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
|
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.CommandValueFlag;
|
||||||
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
|
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
|
||||||
import org.mvplugins.multiverse.core.commandtools.queue.QueuedCommand;
|
import org.mvplugins.multiverse.core.commandtools.queue.QueuedCommand;
|
||||||
@ -31,49 +30,49 @@ import org.mvplugins.multiverse.core.worldnew.options.RegenWorldOptions;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class RegenCommand extends MultiverseCommand {
|
class RegenCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
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
|
@Inject
|
||||||
public RegenCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
RegenCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
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")
|
@Subcommand("regen")
|
||||||
@CommandPermission("multiverse.core.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")
|
@Syntax("<world> --seed [seed] --keep-gamerules")
|
||||||
@Description("{@@mv-core.regen.description}")
|
@Description("{@@mv-core.regen.description}")
|
||||||
public void onRegenCommand(MVCommandIssuer issuer,
|
void onRegenCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.regen.world.description}")
|
@Description("{@@mv-core.regen.world.description}")
|
||||||
LoadedMultiverseWorld world,
|
LoadedMultiverseWorld world,
|
||||||
|
|
||||||
@Optional
|
@Optional
|
||||||
@Syntax("--seed [seed] --reset-gamerules")
|
@Syntax("--seed [seed] --reset-gamerules")
|
||||||
@Description("{@@mv-core.regen.other.description}")
|
@Description("{@@mv-core.regen.other.description}")
|
||||||
String[] flags
|
String[] flags) {
|
||||||
) {
|
|
||||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||||
|
|
||||||
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
|
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||||
@ -81,11 +80,11 @@ public class RegenCommand extends MultiverseCommand {
|
|||||||
() -> {
|
() -> {
|
||||||
issuer.sendInfo(MVCorei18n.REGEN_REGENERATING, "{world}", world.getName());
|
issuer.sendInfo(MVCorei18n.REGEN_REGENERATING, "{world}", world.getName());
|
||||||
worldManager.regenWorld(RegenWorldOptions.world(world)
|
worldManager.regenWorld(RegenWorldOptions.world(world)
|
||||||
.randomSeed(parsedFlags.hasFlag("--seed"))
|
.randomSeed(parsedFlags.hasFlag(SEED_FLAG))
|
||||||
.seed(parsedFlags.flagValue("--seed", String.class))
|
.seed(parsedFlags.flagValue(SEED_FLAG))
|
||||||
.keepWorldConfig(!parsedFlags.hasFlag("--reset-world-config"))
|
.keepWorldConfig(!parsedFlags.hasFlag(RESET_WORLD_CONFIG_FLAG))
|
||||||
.keepGameRule(!parsedFlags.hasFlag("--reset-gamerules"))
|
.keepGameRule(!parsedFlags.hasFlag(RESET_GAMERULES_FLAG))
|
||||||
.keepWorldBorder(!parsedFlags.hasFlag("--reset-world-border"))
|
.keepWorldBorder(!parsedFlags.hasFlag(RESET_WORLD_BORDER_FLAG))
|
||||||
).onSuccess(newWorld -> {
|
).onSuccess(newWorld -> {
|
||||||
Logging.fine("World regen success: " + newWorld);
|
Logging.fine("World regen success: " + newWorld);
|
||||||
issuer.sendInfo(MVCorei18n.REGEN_SUCCESS, "{world}", newWorld.getName());
|
issuer.sendInfo(MVCorei18n.REGEN_SUCCESS, "{world}", newWorld.getName());
|
||||||
@ -95,10 +94,6 @@ public class RegenCommand extends MultiverseCommand {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
this.commandManager.formatMessage(
|
this.commandManager.formatMessage(
|
||||||
issuer,
|
issuer, MessageType.INFO, MVCorei18n.REGEN_PROMPT, "{world}", world.getName())));
|
||||||
MessageType.INFO,
|
|
||||||
MVCorei18n.REGEN_PROMPT,
|
|
||||||
"{world}", world.getName())
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class ReloadCommand extends MultiverseCommand {
|
class ReloadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final MVCoreConfig config;
|
private final MVCoreConfig config;
|
||||||
private final AnchorManager anchorManager;
|
private final AnchorManager anchorManager;
|
||||||
@ -31,13 +31,12 @@ public class ReloadCommand extends MultiverseCommand {
|
|||||||
private final PluginManager pluginManager;
|
private final PluginManager pluginManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ReloadCommand(
|
ReloadCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull MVCoreConfig config,
|
@NotNull MVCoreConfig config,
|
||||||
@NotNull AnchorManager anchorManager,
|
@NotNull AnchorManager anchorManager,
|
||||||
@NotNull WorldManager worldManager,
|
@NotNull WorldManager worldManager,
|
||||||
@NotNull PluginManager pluginManager
|
@NotNull PluginManager pluginManager) {
|
||||||
) {
|
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.anchorManager = anchorManager;
|
this.anchorManager = anchorManager;
|
||||||
@ -48,7 +47,7 @@ public class ReloadCommand extends MultiverseCommand {
|
|||||||
@Subcommand("reload")
|
@Subcommand("reload")
|
||||||
@CommandPermission("multiverse.core.reload")
|
@CommandPermission("multiverse.core.reload")
|
||||||
@Description("{@@mv-core.reload.description}")
|
@Description("{@@mv-core.reload.description}")
|
||||||
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
|
void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
|
||||||
issuer.sendInfo(MVCorei18n.RELOAD_RELOADING);
|
issuer.sendInfo(MVCorei18n.RELOAD_RELOADING);
|
||||||
try {
|
try {
|
||||||
// TODO: Make this all Try<Void>
|
// TODO: Make this all Try<Void>
|
||||||
|
@ -21,12 +21,12 @@ import org.mvplugins.multiverse.core.worldnew.WorldManager;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class RemoveCommand extends MultiverseCommand {
|
class RemoveCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
private final WorldManager worldManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RemoveCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
RemoveCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
}
|
}
|
||||||
@ -36,14 +36,14 @@ public class RemoveCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvworlds:scope=both")
|
@CommandCompletion("@mvworlds:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.remove.description}")
|
@Description("{@@mv-core.remove.description}")
|
||||||
public void onRemoveCommand(MVCommandIssuer issuer,
|
void onRemoveCommand(
|
||||||
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("mvworlds:scope=both")
|
@Conditions("mvworlds:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.remove.world.description}")
|
@Description("{@@mv-core.remove.world.description}")
|
||||||
String worldName
|
String worldName) {
|
||||||
) {
|
|
||||||
worldManager.removeWorld(worldName)
|
worldManager.removeWorld(worldName)
|
||||||
.onSuccess(removedWorldName -> {
|
.onSuccess(removedWorldName -> {
|
||||||
Logging.fine("World remove success: " + removedWorldName);
|
Logging.fine("World remove success: " + removedWorldName);
|
||||||
|
@ -14,18 +14,18 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
|||||||
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RootCommand extends MultiverseCommand {
|
class RootCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RootCommand(@NotNull MVCommandManager commandManager, @NotNull MultiverseCore plugin) {
|
RootCommand(@NotNull MVCommandManager commandManager, @NotNull MultiverseCore plugin) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public void onRootCommand(CommandIssuer issuer) {
|
void onRootCommand(CommandIssuer issuer) {
|
||||||
PluginDescriptionFile description = this.plugin.getDescription();
|
PluginDescriptionFile description = this.plugin.getDescription();
|
||||||
issuer.sendInfo(MVCorei18n.ROOT_TITLE,
|
issuer.sendInfo(MVCorei18n.ROOT_TITLE,
|
||||||
"{name}", description.getName(),
|
"{name}", description.getName(),
|
||||||
|
@ -26,13 +26,13 @@ import org.mvplugins.multiverse.core.utils.MVCorei18n;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class TeleportCommand extends MultiverseCommand {
|
class TeleportCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final CorePermissionsChecker permissionsChecker;
|
private final CorePermissionsChecker permissionsChecker;
|
||||||
private final AsyncSafetyTeleporter safetyTeleporter;
|
private final AsyncSafetyTeleporter safetyTeleporter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public TeleportCommand(
|
TeleportCommand(
|
||||||
@NotNull MVCommandManager commandManager,
|
@NotNull MVCommandManager commandManager,
|
||||||
@NotNull CorePermissionsChecker permissionsChecker,
|
@NotNull CorePermissionsChecker permissionsChecker,
|
||||||
@NotNull AsyncSafetyTeleporter safetyTeleporter) {
|
@NotNull AsyncSafetyTeleporter safetyTeleporter) {
|
||||||
@ -46,7 +46,7 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@players|@mvworlds:playerOnly|@destinations:playerOnly @mvworlds|@destinations")
|
@CommandCompletion("@players|@mvworlds:playerOnly|@destinations:playerOnly @mvworlds|@destinations")
|
||||||
@Syntax("[player] <destination>")
|
@Syntax("[player] <destination>")
|
||||||
@Description("{@@mv-core.teleport.description}")
|
@Description("{@@mv-core.teleport.description}")
|
||||||
public void onTeleportCommand(
|
void onTeleportCommand(
|
||||||
MVCommandIssuer issuer,
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Flags("resolve=issuerAware")
|
@Flags("resolve=issuerAware")
|
||||||
|
@ -24,7 +24,7 @@ import org.mvplugins.multiverse.core.worldnew.options.UnloadWorldOptions;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class UnloadCommand extends MultiverseCommand {
|
class UnloadCommand extends MultiverseCommand {
|
||||||
|
|
||||||
private final WorldManager worldManager;
|
private final WorldManager worldManager;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class UnloadCommand extends MultiverseCommand {
|
|||||||
.build());
|
.build());
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public UnloadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
UnloadCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class UnloadCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@mvworlds @flags:groupName=mvunloadcommand")
|
@CommandCompletion("@mvworlds @flags:groupName=mvunloadcommand")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.unload.description}")
|
@Description("{@@mv-core.unload.description}")
|
||||||
public void onUnloadCommand(
|
void onUnloadCommand(
|
||||||
MVCommandIssuer issuer,
|
MVCommandIssuer issuer,
|
||||||
|
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
|
@ -17,10 +17,10 @@ import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandAlias("mv")
|
@CommandAlias("mv")
|
||||||
public class UsageCommand extends MultiverseCommand {
|
class UsageCommand extends MultiverseCommand {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public UsageCommand(@NotNull MVCommandManager commandManager) {
|
UsageCommand(@NotNull MVCommandManager commandManager) {
|
||||||
super(commandManager);
|
super(commandManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class UsageCommand extends MultiverseCommand {
|
|||||||
@CommandCompletion("@commands:mv")
|
@CommandCompletion("@commands:mv")
|
||||||
@Syntax("[filter] [page]")
|
@Syntax("[filter] [page]")
|
||||||
@Description("{@@mv-core.usage.description}")
|
@Description("{@@mv-core.usage.description}")
|
||||||
public void onUsageCommand(CommandHelp help) {
|
void onUsageCommand(CommandHelp help) {
|
||||||
if (help.getIssuer().isPlayer()) {
|
if (help.getIssuer().isPlayer()) {
|
||||||
// Prevent flooding the chat
|
// Prevent flooding the chat
|
||||||
help.setPerPage(4);
|
help.setPerPage(4);
|
||||||
|
@ -263,7 +263,7 @@ public class CommandValueFlag<T> extends CommandFlag {
|
|||||||
* @return The flag.
|
* @return The flag.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public @NotNull CommandFlag build() {
|
public @NotNull CommandValueFlag<T> build() {
|
||||||
return new CommandValueFlag<>(key, aliases, type, optional, defaultValue, context, completion);
|
return new CommandValueFlag<>(key, aliases, type, optional, defaultValue, context, completion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,17 @@ public class ParsedCommandFlags
|
|||||||
return (T) value;
|
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.
|
* Get the value of a flag.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user