diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/CheckCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/CheckCommand.java index 0a2f165b..a1283ff0 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/CheckCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/CheckCommand.java @@ -30,6 +30,7 @@ class CheckCommand extends MultiverseCommand { this.destinationsProvider = destinationsProvider; } + @CommandAlias("mvcheck") @Subcommand("check") @CommandPermission("multiverse.core.check") @CommandCompletion("@players @destinations|@mvworlds") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/CloneCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/CloneCommand.java index 9493e7ad..5875e110 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/CloneCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/CloneCommand.java @@ -46,6 +46,7 @@ class CloneCommand extends MultiverseCommand { this.worldManager = worldManager; } + @CommandAlias("mvcl|mvclone") @Subcommand("clone") @CommandPermission("multiverse.core.clone") @CommandCompletion("@mvworlds:scope=loaded @empty @flags:groupName=mvclonecommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ConfigCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ConfigCommand.java index 18ac8b06..ec0d17e1 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ConfigCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ConfigCommand.java @@ -30,6 +30,7 @@ class ConfigCommand extends MultiverseCommand { this.config = config; } + @CommandAlias("mvconfig|mvconf") @Subcommand("config") @CommandPermission("multiverse.core.config") @CommandCompletion("@mvconfigs @mvconfigvalues") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ConfirmCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ConfirmCommand.java index b14fd6a6..f37b8ef0 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ConfirmCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ConfirmCommand.java @@ -21,6 +21,7 @@ class ConfirmCommand extends MultiverseCommand { super(commandManager); } + @CommandAlias("mvconfirm") @Subcommand("confirm") @CommandPermission("multiverse.core.confirm") @Description("{@@mv-core.confirm.description}") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/CoordinatesCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/CoordinatesCommand.java index dcf48f2d..71055ba8 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/CoordinatesCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/CoordinatesCommand.java @@ -30,7 +30,7 @@ class CoordinatesCommand extends MultiverseCommand { super(commandManager); this.locationManipulation = locationManipulation; } - + @CommandAlias("mvcoord|mvco") @Subcommand("coordinates|coords|coord|co") @CommandPermission("multiverse.core.coord") @Description("{@@mv-core.coordinates.description}") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/CreateCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/CreateCommand.java index e05f6125..824bc554 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/CreateCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/CreateCommand.java @@ -69,6 +69,7 @@ class CreateCommand extends MultiverseCommand { this.generatorProvider = generatorProvider; } + @CommandAlias("mvcreate|mvc") @Subcommand("create") @CommandPermission("multiverse.core.create") @CommandCompletion("@empty @environments @flags:groupName=mvcreatecommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DebugCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/DebugCommand.java index 7a315471..119074eb 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DebugCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DebugCommand.java @@ -36,6 +36,7 @@ class DebugCommand extends MultiverseCommand { this.displayDebugMode(issuer); } + @CommandAlias("mvdebug") @Subcommand("debug") @CommandPermission("multiverse.core.debug") @CommandCompletion("@range:3") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DeleteCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/DeleteCommand.java index db4d448f..3d5a50d9 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DeleteCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DeleteCommand.java @@ -50,6 +50,7 @@ class DeleteCommand extends MultiverseCommand { this.playerWorldTeleporter = playerWorldTeleporter; } + @CommandAlias("mvdelete") @Subcommand("delete") @CommandPermission("multiverse.core.delete") @CommandCompletion("@mvworlds:scope=loaded @flags:groupName=mvdeletecommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/GeneratorsCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/GeneratorsCommand.java index 372fb2c2..28899382 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/GeneratorsCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/GeneratorsCommand.java @@ -69,6 +69,7 @@ class GeneratorsCommand extends MultiverseCommand { this.generatorProvider = generatorProvider; } + @CommandAlias("mvgenerators|mvgens") @Subcommand("generators|gens") @CommandPermission("multiverse.core.generator") @CommandCompletion("@flags:groupName=mvgeneratorscommand @flags:groupName=mvgeneratorscommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ImportCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ImportCommand.java index 859de2dd..bc351967 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ImportCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ImportCommand.java @@ -52,6 +52,7 @@ class ImportCommand extends MultiverseCommand { this.generatorProvider = generatorProvider; } + @CommandAlias("mvimport|mvim") @Subcommand("import") @CommandPermission("multiverse.core.import") @CommandCompletion("@mvworlds:scope=potential @environments @flags:groupName=mvimportcommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/InfoCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/InfoCommand.java index 60436e8d..2f5d0fa7 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/InfoCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/InfoCommand.java @@ -75,6 +75,7 @@ class InfoCommand extends MultiverseCommand { } // TODO: support info for unloaded worlds + @CommandAlias("mvinfo|mvi") @Subcommand("info") @CommandPermission("multiverse.core.info") @CommandCompletion("@mvworlds:scope=both|@flags:groupName=mvinfocommand @flags:groupName=mvinfocommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ListCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ListCommand.java index 7ac60aed..307f0816 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ListCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ListCommand.java @@ -73,6 +73,7 @@ class ListCommand extends MultiverseCommand { this.worldEntryCheckerProvider = worldEntryCheckerProvider; } + @CommandAlias("mvlist|mvl") @Subcommand("list") @CommandPermission("multiverse.core.list.worlds") @CommandCompletion("@flags:groupName=mvlistcommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/LoadCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/LoadCommand.java index e72ef798..a5e75f74 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/LoadCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/LoadCommand.java @@ -31,6 +31,7 @@ class LoadCommand extends MultiverseCommand { this.worldManager = worldManager; } + @CommandAlias("mvload") @Subcommand("load") @CommandPermission("multiverse.core.load") @CommandCompletion("@mvworlds:scope=unloaded") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ModifyCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ModifyCommand.java index 87a58e0b..d881626a 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ModifyCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ModifyCommand.java @@ -10,6 +10,7 @@ import co.aikar.commands.annotation.Subcommand; import co.aikar.commands.annotation.Syntax; import com.dumptruckman.minecraft.util.Logging; import jakarta.inject.Inject; +import org.bukkit.ChatColor; import org.jetbrains.annotations.NotNull; import org.jvnet.hk2.annotations.Service; @@ -33,6 +34,7 @@ class ModifyCommand extends MultiverseCommand { this.worldManager = worldManager; } + @CommandAlias("mvmodify|mvm") @Subcommand("modify") @CommandPermission("multiverse.core.modify") @CommandCompletion("@mvworlds:scope=both @propsmodifyaction @mvworldpropsname @mvworldpropsvalue") @@ -60,17 +62,27 @@ class ModifyCommand extends MultiverseCommand { String propertyValue) { StringPropertyHandle worldPropertyHandle = world.getStringPropertyHandle(); worldPropertyHandle.modifyProperty(propertyName, propertyValue, action).onSuccess(ignore -> { - issuer.sendMessage("Property %s set to %s for world %s.".formatted( + issuer.sendMessage("Property %s%s set to %s%s for world %s%s%s.".formatted( propertyName, + ChatColor.BLUE, worldPropertyHandle.getProperty(propertyName).getOrNull(), - world.getName())); + ChatColor.BLUE, + ChatColor.GRAY, + world.getName(), + ChatColor.BLUE + )); worldManager.saveWorldsConfig(); }).onFailure(exception -> { - issuer.sendMessage("Failed to %s property %s to %s for world %s.".formatted( + issuer.sendMessage("Failed to %s%s property %s%s to %s%s for world %s%s.".formatted( action.name().toLowerCase(), + ChatColor.BLUE, propertyName, + ChatColor.BLUE, propertyValue, - world.getName())); + ChatColor.BLUE, + world.getName(), + ChatColor.BLUE + )); issuer.sendMessage(exception.getMessage()); }); } diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/RegenCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/RegenCommand.java index 23f56a14..21773f4a 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/RegenCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/RegenCommand.java @@ -70,6 +70,7 @@ class RegenCommand extends MultiverseCommand { this.playerWorldTeleporter = playerWorldTeleporter; } + @CommandAlias("mvregen") @Subcommand("regen") @CommandPermission("multiverse.core.regen") @CommandCompletion("@mvworlds:scope=loaded @flags:groupName=mvregencommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/ReloadCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/ReloadCommand.java index 2630de1f..d39641f2 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/ReloadCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/ReloadCommand.java @@ -44,6 +44,7 @@ class ReloadCommand extends MultiverseCommand { this.pluginManager = pluginManager; } + @CommandAlias("mvreload|mvr") @Subcommand("reload") @CommandPermission("multiverse.core.reload") @Description("{@@mv-core.reload.description}") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java index 4888082c..d2ecb942 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java @@ -48,6 +48,7 @@ class RemoveCommand extends MultiverseCommand { this.playerWorldTeleporter = playerWorldTeleporter; } + @CommandAlias("mvremove") @Subcommand("remove") @CommandPermission("multiverse.core.remove") @CommandCompletion("@mvworlds:scope=both") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/UnloadCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/UnloadCommand.java index 42a85aa4..48204f4d 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/UnloadCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/UnloadCommand.java @@ -51,6 +51,7 @@ class UnloadCommand extends MultiverseCommand { this.playerWorldTeleporter = playerWorldTeleporter; } + @CommandAlias("mvunload") @Subcommand("unload") @CommandPermission("multiverse.core.unload") @CommandCompletion("@mvworlds @flags:groupName=mvunloadcommand") diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java new file mode 100644 index 00000000..4b417ad5 --- /dev/null +++ b/src/main/java/org/mvplugins/multiverse/core/commands/VersionCommand.java @@ -0,0 +1,38 @@ +package org.mvplugins.multiverse.core.commands; + +import co.aikar.commands.BukkitCommandIssuer; +import co.aikar.commands.MessageType; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Subcommand; +import jakarta.inject.Inject; +import org.jetbrains.annotations.NotNull; +import org.jvnet.hk2.annotations.Service; +import org.mvplugins.multiverse.core.MultiverseCore; +import org.mvplugins.multiverse.core.commandtools.MVCommandManager; +import org.mvplugins.multiverse.core.commandtools.MultiverseCommand; +import org.mvplugins.multiverse.core.utils.MVCorei18n; + +@Service +@CommandAlias("mv") +class VersionCommand extends MultiverseCommand { + + private final MultiverseCore plugin; + + @Inject + VersionCommand(@NotNull MVCommandManager commandManager, MultiverseCore plugin) { + super(commandManager); + this.plugin = plugin; + } + + @CommandAlias("mvversion") + @Subcommand("version") + @CommandPermission("multiverse.core.version") + @Description("{@@mv-core.version.description}") + void versionCommand(BukkitCommandIssuer issuer) { + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_MV, "{version}", plugin.getDescription().getVersion()); + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_AUTHORS, "{authors}", String.join(", ", plugin.getDescription().getAuthors())); + issuer.sendMessage(MessageType.INFO, MVCorei18n.VERSION_SECRETCODE); // An in joke I don't get... + } +} diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/WhoCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/WhoCommand.java new file mode 100644 index 00000000..13e80c72 --- /dev/null +++ b/src/main/java/org/mvplugins/multiverse/core/commands/WhoCommand.java @@ -0,0 +1,162 @@ +package org.mvplugins.multiverse.core.commands; + +import co.aikar.commands.InvalidCommandArgument; +import co.aikar.commands.annotation.CommandAlias; +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.Subcommand; +import co.aikar.commands.annotation.Syntax; +import com.dumptruckman.minecraft.util.Logging; +import jakarta.inject.Inject; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jvnet.hk2.annotations.Service; +import org.mvplugins.multiverse.core.commandtools.MultiverseCommand; +import org.mvplugins.multiverse.core.commandtools.MVCommandIssuer; +import org.mvplugins.multiverse.core.commandtools.MVCommandManager; +import org.mvplugins.multiverse.core.commandtools.flags.CommandValueFlag; +import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags; +import org.mvplugins.multiverse.core.display.ContentDisplay; +import org.mvplugins.multiverse.core.display.filters.ContentFilter; +import org.mvplugins.multiverse.core.display.filters.DefaultContentFilter; +import org.mvplugins.multiverse.core.display.filters.RegexContentFilter; +import org.mvplugins.multiverse.core.display.handlers.PagedSendHandler; +import org.mvplugins.multiverse.core.display.parsers.MapContentProvider; +import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld; +import org.mvplugins.multiverse.core.world.WorldManager; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@CommandAlias("mv") +public class WhoCommand extends MultiverseCommand { + + private final WorldManager worldManager; + + private final CommandValueFlag 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 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 + WhoCommand(@NotNull MVCommandManager commandManager, @NotNull WorldManager worldManager) { + super(commandManager); + this.worldManager = worldManager; + } + + @Subcommand("whoall") + @CommandPermission("multiverse.core.list.who.all") + @CommandCompletion("@flags:groupName=mvwhocommand") + @Syntax("[--page ] [--filter ]") + @Description("{@@mv-core.who.all.description}") + void onWhoAllCommand( + MVCommandIssuer issuer, + + @Optional + @Syntax("[--page ] [--filter ]") + @Description("{@@mv-core.who.flags.description}") + String[] flags) { + ParsedCommandFlags parsedFlags = parseFlags(flags); + + // Send the display + getListDisplay( + worldManager.getLoadedWorlds(), + parsedFlags.flagValue(PAGE_FLAG, 1), + parsedFlags.flagValue(FILTER_FLAG, DefaultContentFilter.get()), + true + ).send(issuer); + + } + + @Subcommand("who") + @CommandPermission("multiverse.core.list.who") + @CommandCompletion("@mvworlds:scope=both @flags:groupName=mvwhocommand") + @Syntax(" [--page ] [--filter ]") + @Description("{@@mv-core.who.description}") + void onWhoCommand( + MVCommandIssuer issuer, + + @Syntax("") + @Description("{@@mv-core.who.world.description}") + LoadedMultiverseWorld inputtedWorld, + + @Optional + @Syntax("[--page ] [--filter ]") + @Description("{@@mv-core.who.flags.description}") + String[] flags) { + ParsedCommandFlags parsedFlags = parseFlags(flags); + + // Send the display + getListDisplay( + inputtedWorld, + parsedFlags.flagValue(PAGE_FLAG, 1), + parsedFlags.flagValue(FILTER_FLAG, DefaultContentFilter.get()), + false + ).send(issuer); + } + + private String phrasePlayerList(List players) { + return players.stream().map(Player::getName).collect(Collectors.joining(", ")); + } + + private ContentDisplay getListDisplay(LoadedMultiverseWorld world, int page, ContentFilter filter, boolean ignoreEmptyWorlds) { + Collection listingWorlds = new ArrayList<>(); + listingWorlds.add(world); + return getListDisplay(listingWorlds, page, filter, ignoreEmptyWorlds); + } + + private ContentDisplay getListDisplay(Collection worlds, int page, ContentFilter filter, boolean ignoreEmptyWorlds) { + HashMap outMap = new HashMap<>(); + + // Add all the worlds to our hashmap + for (LoadedMultiverseWorld world : worlds) { + @Nullable List players = world.getPlayers().getOrNull(); + + // If the world has 0 players in it, say that it is empty + if ((players == null || players.isEmpty()) && !ignoreEmptyWorlds) { + outMap.put(world.getAlias(), ChatColor.RED + "Empty"); + continue; + } + if (players == null || players.isEmpty()) { + continue; + } + + outMap.put(world.getAlias(), phrasePlayerList(players)); + } + + return ContentDisplay.create() + .addContent(MapContentProvider.forContent(outMap)) + .withSendHandler(PagedSendHandler.create() + .withHeader("%s====[ Multiverse World Players List ]====", ChatColor.AQUA) + .doPagination(true) + .withTargetPage(page) + .withFilter(filter)); + } +} diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java b/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java index 146dd0b1..e24acf1e 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/MVCorei18n.java @@ -108,6 +108,18 @@ public enum MVCorei18n implements MessageKeyProvider { UNLOAD_UNLOADING, UNLOAD_SUCCESS, + // who command + WHO_DESCRIPTION, + WHO_ALL_DESCRIPTION, + WHO_WORLD_DESCRIPTION, + WHO_FLAGS_DESCRIPTION, + WHO_EMPTY, + + // version command + VERSION_MV, + VERSION_AUTHORS, + VERSION_SECRETCODE, + // debug command DEBUG_INFO_OFF, DEBUG_INFO_ON, diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/result/AsyncAttempt.java b/src/main/java/org/mvplugins/multiverse/core/utils/result/AsyncAttempt.java index 67b8a9a0..f57268ae 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/result/AsyncAttempt.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/result/AsyncAttempt.java @@ -3,6 +3,7 @@ package org.mvplugins.multiverse.core.utils.result; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.Function; import org.mvplugins.multiverse.core.utils.message.MessageReplacement; @@ -67,6 +68,19 @@ public final class AsyncAttempt { return new AsyncAttempt<>(future.thenApply(attempt -> attempt.onSuccess(runnable))); } + public AsyncAttempt onFailure(Runnable runnable) { + // TODO Not sure why we creating a new instance instead of using `this` + return new AsyncAttempt<>(future.thenApply(attempt -> attempt.onFailure(runnable))); + } + + public AsyncAttempt onFailure(Consumer> consumer) { + return new AsyncAttempt<>(future.thenApply(attempt -> attempt.onFailure(consumer))); + } + + public AsyncAttempt onFailureReason(Consumer consumer) { + return new AsyncAttempt<>(future.thenApply(attempt -> attempt.onFailureReason(consumer))); + } + public Attempt toAttempt() { return future.join(); } diff --git a/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java b/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java index 6e1a31e8..b46ec662 100644 --- a/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java +++ b/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java @@ -734,7 +734,7 @@ public class WorldManager { * @return The world if it exists. */ public Option getWorld(@Nullable World world) { - return Option.of(world).flatMap(this::getWorld); + return Option.of(world).map(World::getName).flatMap(this::getWorld); } /** diff --git a/src/main/resources/multiverse-core_en.properties b/src/main/resources/multiverse-core_en.properties index ea3b7b10..06146827 100644 --- a/src/main/resources/multiverse-core_en.properties +++ b/src/main/resources/multiverse-core_en.properties @@ -146,6 +146,20 @@ mv-core.unload.success=&aWorld '{world}' unloaded! # /mv usage mv-core.usage.description=Show Multiverse-Core command usage. +# /mv who +# /mv whoall +mv-core.who.description=Lists the players in the world specified +mv-core.who.all.description=Lists the players in all worlds +mv-core.who.world.description=Name of the world you want to list players in +mv-core.who.flags.description=Filter - only shows entries matching this. Page - the page to show +mv-core.who.empty=&rEmpty + +# /mv version +mv-core.version.description=Displays version and authors +mv-core.version.mv=Multiverse Core Version &fv{version} +mv-core.version.authors=Multiverse Core Authors &f{authors} +mv-core.version.secretcode=Special Code: &fFRN002 + # commands error mv-core.commands.error.playersonly=&cThis command can only be used by players mv-core.commands.error.multiverseworldonly=&cThis can only be used in multiverse worlds diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8a26e307..f4bc2d69 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Multiverse-Core main: org.mvplugins.multiverse.core.MultiverseCore -authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--'] +authors: ['dumptruckman', 'Rigby', 'fernferret', 'lithium3141', 'main--', 'benwoo1110', 'Zax71'] website: 'https://dev.bukkit.org/projects/multiverse-core' softdepend: ['Vault', 'PlaceholderAPI'] api-version: 1.13