From ead52ef3aaf9ce7ffd2a1c6f49dfe0f1a8179187 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sun, 20 Nov 2022 13:44:01 -0700 Subject: [PATCH] Javadoc and SelectorUtils cleanup --- .../injection/ParameterInjectorRegistry.java | 3 ++- .../bukkit/parsers/selector/SelectorUtils.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cloud-core/src/main/java/cloud/commandframework/annotations/injection/ParameterInjectorRegistry.java b/cloud-core/src/main/java/cloud/commandframework/annotations/injection/ParameterInjectorRegistry.java index 324b6176..55c1ad62 100644 --- a/cloud-core/src/main/java/cloud/commandframework/annotations/injection/ParameterInjectorRegistry.java +++ b/cloud-core/src/main/java/cloud/commandframework/annotations/injection/ParameterInjectorRegistry.java @@ -41,7 +41,8 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; /** - * Registry containing mappings between {@link Class classes} and {@link ParameterInjector injectors} + * Registry containing mappings between {@link Class} {@link Predicate Predicates} + * and {@link ParameterInjector injectors}. * * The order injectors are tested is the same order they were registered in. * diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SelectorUtils.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SelectorUtils.java index ab7e2a4a..5a2db6c0 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SelectorUtils.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SelectorUtils.java @@ -435,24 +435,24 @@ final class SelectorUtils { @SuppressWarnings("unchecked") List entities() { - return reflectiveOperation(() -> ((List) this.methods().entities.invoke( + final List internalEntities = reflectiveOperation(() -> ((List) this.methods().entities.invoke( this.selector, this.commandContext.get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER) - )) - .stream() + ))); + return internalEntities.stream() .map(o -> reflectiveOperation(() -> (Entity) this.methods().getBukkitEntity.invoke(o))) - .collect(Collectors.toList())); + .collect(Collectors.toList()); } @SuppressWarnings("unchecked") List players() { - return reflectiveOperation(() -> ((List) this.methods().players.invoke( + final List serverPlayers = reflectiveOperation(() -> ((List) this.methods().players.invoke( this.selector, this.commandContext.get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER) - )) - .stream() + ))); + return serverPlayers.stream() .map(o -> reflectiveOperation(() -> (Player) this.methods().getBukkitEntity.invoke(o))) - .collect(Collectors.toList())); + .collect(Collectors.toList()); } @FunctionalInterface