Skip to content

Commit

Permalink
use computeIfAbsent
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Dec 24, 2023
1 parent 707e710 commit 44d0da5
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ public void accept(final @NonNull CommandPreprocessingContext<C> context) {
);

// Store if PaperCommandManager's preprocessor didn't already
if (!context.commandContext().contains(BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR)) {
context.commandContext().store(BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR, this.mainThreadExecutor());
}
context.commandContext().computeIfAbsent(
BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR,
$ -> this.mainThreadExecutor()
);
}

private Executor mainThreadExecutor() {
Expand Down

0 comments on commit 44d0da5

Please sign in to comment.