Javadoc and SelectorUtils cleanup

This commit is contained in:
Jason Penilla 2022-11-20 13:44:01 -07:00 committed by Jason
parent 7897159a1c
commit ead52ef3aa
2 changed files with 10 additions and 9 deletions

View file

@ -41,7 +41,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; 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. * The order injectors are tested is the same order they were registered in.
* *

View file

@ -435,24 +435,24 @@ final class SelectorUtils {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Entity> entities() { List<Entity> entities() {
return reflectiveOperation(() -> ((List<Object>) this.methods().entities.invoke( final List<Object> internalEntities = reflectiveOperation(() -> ((List<Object>) this.methods().entities.invoke(
this.selector, this.selector,
this.commandContext.<Object>get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER) this.commandContext.<Object>get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER)
)) )));
.stream() return internalEntities.stream()
.map(o -> reflectiveOperation(() -> (Entity) this.methods().getBukkitEntity.invoke(o))) .map(o -> reflectiveOperation(() -> (Entity) this.methods().getBukkitEntity.invoke(o)))
.collect(Collectors.toList())); .collect(Collectors.toList());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Player> players() { List<Player> players() {
return reflectiveOperation(() -> ((List<Object>) this.methods().players.invoke( final List<Object> serverPlayers = reflectiveOperation(() -> ((List<Object>) this.methods().players.invoke(
this.selector, this.selector,
this.commandContext.<Object>get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER) this.commandContext.<Object>get(WrappedBrigadierParser.COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER)
)) )));
.stream() return serverPlayers.stream()
.map(o -> reflectiveOperation(() -> (Player) this.methods().getBukkitEntity.invoke(o))) .map(o -> reflectiveOperation(() -> (Player) this.methods().getBukkitEntity.invoke(o)))
.collect(Collectors.toList())); .collect(Collectors.toList());
} }
@FunctionalInterface @FunctionalInterface