Make changes from PR comments

This commit is contained in:
jmp 2020-10-22 14:46:06 -07:00 committed by Alexander Söderberg
parent 9b80bb9eb7
commit 6ffee9d04f
6 changed files with 16 additions and 6 deletions

View file

@ -621,7 +621,7 @@ public final class CommandTree<C> {
Objects.requireNonNull(
Objects.requireNonNull(
node.value,
"node.value: "
"node.value"
).getOwningCommand(),
"owning command"
).getCommandPermission()

View file

@ -42,6 +42,7 @@ import java.util.Set;
* Command Argument for {@link User}
*
* @param <C> Command sender type
* @since 1.1.0
*/
@SuppressWarnings("unused")
public final class UserArgument<C> extends CommandArgument<C, User> {

View file

@ -25,6 +25,7 @@ package cloud.commandframework.bukkit.arguments.selector;
import org.bukkit.entity.Entity;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
@ -47,11 +48,14 @@ public final class SingleEntitySelector extends MultipleEntitySelector {
}
/**
* Get the selected entity
* Get the selected entity or null if no entity matched
*
* @return Gets the single Bukkit Entity parsed by the selector
*/
public @NonNull Entity getEntity() {
public @Nullable Entity getEntity() {
if (this.getEntities().isEmpty()) {
return null;
}
return this.getEntities().get(0);
}

View file

@ -26,6 +26,7 @@ package cloud.commandframework.bukkit.arguments.selector;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
@ -48,11 +49,14 @@ public final class SinglePlayerSelector extends MultiplePlayerSelector {
}
/**
* Get the selected player
* Get the selected player or null if no player matched
*
* @return Gets the single player parsed by the selector
*/
public @NonNull Player getPlayer() {
public @Nullable Player getPlayer() {
if (this.getPlayers().isEmpty()) {
return null;
}
return this.getPlayers().get(0);
}

View file

@ -144,6 +144,7 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
}
public static final class LocationParser<C> implements ArgumentParser<C, Location> {
private static final int EXPECTED_PARAMETER_COUNT = 3;

View file

@ -47,7 +47,7 @@ public class BungeeCommandManager<C> extends CommandManager<C> {
public static final String ARGUMENT_PARSE_FAILURE_PLAYER = "'{input}' is not a valid player";
/**
* Default caption for {@link BungeeCaptionKeys#ARGUMENT_PARSE_FAILURE_PLAYER}
* Default caption for {@link BungeeCaptionKeys#ARGUMENT_PARSE_FAILURE_SERVER}
*/
public static final String ARGUMENT_PARSE_FAILURE_SERVER = "'{input}' is not a valid server";