Skip to content

Commit

Permalink
Refactor world suggestion filtering in unload command
Browse files Browse the repository at this point in the history
Update the WorldUnloadCommand to include a context-based filtering mechanism for the fallback argument. This ensures the fallback world suggestion does not match the world being unloaded, enhancing command reliability.
  • Loading branch information
NonSwag committed Aug 15, 2024
1 parent ba3762e commit 42857f0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class WorldUnloadCommand {
.then(Commands.argument("world", ArgumentTypes.world())
.suggests(new WorldSuggestionProvider<>(plugin))
.then(Commands.argument("fallback", ArgumentTypes.world())
.suggests(new WorldSuggestionProvider<>(plugin)) //, (context, world) ->
//!world.equals(context.getArgument("world", World.class))))
.suggests(new WorldSuggestionProvider<>(plugin, (context, world) ->
!world.equals(context.getLastChild().getArgument("world", World.class))))
.executes(context -> {
var world = context.getArgument("world", World.class);
var fallback = context.getArgument("fallback", World.class);
Expand Down

0 comments on commit 42857f0

Please sign in to comment.