Skip to content

Commit 44d0da5

Browse files
committed
use computeIfAbsent
1 parent 707e710 commit 44d0da5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandPreprocessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ public void accept(final @NonNull CommandPreprocessingContext<C> context) {
8181
);
8282

8383
// Store if PaperCommandManager's preprocessor didn't already
84-
if (!context.commandContext().contains(BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR)) {
85-
context.commandContext().store(BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR, this.mainThreadExecutor());
86-
}
84+
context.commandContext().computeIfAbsent(
85+
BukkitCommandContextKeys.SENDER_SCHEDULER_EXECUTOR,
86+
$ -> this.mainThreadExecutor()
87+
);
8788
}
8889

8990
private Executor mainThreadExecutor() {

0 commit comments

Comments
 (0)