Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
import org.mvplugins.multiverse.core.destination.DestinationInstance;
import org.mvplugins.multiverse.core.destination.DestinationSuggestionPacket;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.destination.core.WorldDestination;
import org.mvplugins.multiverse.core.permissions.CorePermissionsChecker;
import org.mvplugins.multiverse.core.utils.REPatterns;
import org.mvplugins.multiverse.core.utils.StringFormatter;
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld;
import org.mvplugins.multiverse.core.world.MultiverseWorld;
import org.mvplugins.multiverse.core.world.WorldManager;
Expand Down Expand Up @@ -236,6 +236,9 @@ private Collection<String> suggestDestinations(BukkitCommandCompletionContext co

private Collection<String> suggestDestinationsWithPerms(CommandSender teleporter, List<Entity> teleportees, String deststring) {
return destinationsProvider.suggestDestinations(teleporter, deststring).stream()
.filter(packet -> !config.getSimplifiedDestinationTabCompletion()
|| packet.destination() instanceof WorldDestination
|| deststring.startsWith(packet.destination().getIdentifier() + ":"))
.filter(packet -> corePermissionsChecker
.checkDestinationPacketPermission(teleporter, teleportees, packet))
.map(DestinationSuggestionPacket::parsableString)
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/org/mvplugins/multiverse/core/config/CoreConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
import com.dumptruckman.minecraft.util.Logging;
import io.vavr.control.Try;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.EventPriority;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;

import org.mvplugins.multiverse.core.MultiverseCore;
import org.mvplugins.multiverse.core.command.MVCommandManager;
import org.mvplugins.multiverse.core.command.queue.ConfirmMode;
import org.mvplugins.multiverse.core.config.handle.CommentedConfigurationHandle;
import org.mvplugins.multiverse.core.config.handle.StringPropertyHandle;
Expand All @@ -28,7 +25,6 @@
import org.mvplugins.multiverse.core.config.migration.action.MoveMigratorAction;
import org.mvplugins.multiverse.core.config.migration.VersionMigrator;
import org.mvplugins.multiverse.core.config.migration.action.SetMigratorAction;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.teleportation.PassengerMode;
import org.mvplugins.multiverse.core.teleportation.PassengerModes;
import org.mvplugins.multiverse.core.world.helpers.DimensionFinder.DimensionFormat;
Expand Down Expand Up @@ -539,6 +535,16 @@
return configHandle.get(configNodes.resolveAliasName);
}

@ApiStatus.AvailableSince("5.4")

Check warning on line 538 in src/main/java/org/mvplugins/multiverse/core/config/CoreConfig.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/config/CoreConfig.java:538:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
public Try<Void> setSimplifiedDestinationTabCompletion(boolean simplifiedDestinationTabCompletion) {
return configHandle.set(configNodes.simplifiedDestinationTabCompletion, simplifiedDestinationTabCompletion);
}

@ApiStatus.AvailableSince("5.4")
public boolean getSimplifiedDestinationTabCompletion() {
return configHandle.get(configNodes.simplifiedDestinationTabCompletion);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@
.name("resolve-alias-name")
.build());

final ConfigNode<Boolean> simplifiedDestinationTabCompletion = node(ConfigNode.builder("command.simplified-destination-tab-completion", Boolean.class)

Check warning on line 416 in src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Line is longer than 120 characters (found 154). Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java:416:0: warning: Line is longer than 120 characters (found 154). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
.comment("")
.comment("If this is set to true, Multiverse will only suggest simple destination formats in tab completion.")

Check warning on line 418 in src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Line is longer than 120 characters (found 122). Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java:418:0: warning: Line is longer than 120 characters (found 122). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
.comment("This means only world names will be suggested without other destination type such as `e:worldname:x,y,z` or `p:playername`.")

Check warning on line 419 in src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Line is longer than 120 characters (found 147). Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java:419:0: warning: Line is longer than 120 characters (found 147). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
.comment("Note: This DOES NOT prevent players from using the destinations, as that is controlled by permissions.")

Check warning on line 420 in src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Line is longer than 120 characters (found 126). Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java:420:0: warning: Line is longer than 120 characters (found 126). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
.defaultValue(false)
.name("simplified-destination-tab-completion")
.build());

final ConfigNode<ConfirmMode> confirmMode = node(ConfigNode.builder("command.confirm-mode", ConfirmMode.class)
.comment("")
.comment("This config option defines whether `/mv confirm` is needed before running a DANGEROUS action.")
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/configs/fresh_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ messaging:

command:
resolve-alias-name: true
simplified-destination-tab-completion: false
confirm-mode: enable
use-confirm-otp: true
confirm-timeout: 30
Expand Down