This commit is contained in:
kento2 2026-06-03 01:30:22 +02:00
parent b091eb3377
commit 6449d95b66
5 changed files with 11 additions and 11 deletions

View file

@ -7,7 +7,7 @@ plugins {
}
group = "de.kentoj.scrow"
version = "0.6"
version = "0.8"
fun RepositoryHandler.scrowRepo() = maven {
name = "scrow"

View file

@ -1,10 +1,9 @@
package de.kentoj.kencommandapi.type;
import de.kentoj.kencommandapi.BukkitCommandContext;
import de.kentoj.kencommandapi.api.processing.CommandException;
import de.kentoj.kencommandapi.api.argument.ArgumentType;
import de.kentoj.kencommandapi.api.argument.SuggestionProvider;
import de.kentoj.kencommandapi.api.argument.suggestion.NoSuggestionProvider;
import de.kentoj.kencommandapi.api.processing.CommandException;
import de.kentoj.kencommandapi.suggestionprovider.PlayerSuggestionProvider;
import lombok.AccessLevel;
import lombok.Getter;
@ -13,9 +12,6 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class PlayerArgumentType implements ArgumentType<CommandSender, BukkitCommandContext, Player> {

View file

@ -4,6 +4,7 @@ import de.kentoj.kencommandapi.api.argument.ArgumentType;
import de.kentoj.kencommandapi.api.argument.SuggestionProvider;
import de.kentoj.kencommandapi.api.argument.suggestion.NoSuggestionProvider;
import de.kentoj.kencommandapi.api.processing.CommandContext;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@ -11,6 +12,10 @@ public class StringArgumentType<T, S extends CommandContext<T, ?>> implements Ar
private final boolean isGreedy;
public StringArgumentType() {
this(false);
}
@Override
public String parseInput(String string) {
return string;

View file

@ -1,12 +1,12 @@
package de.kentoj.kencommandapi.impl;
import de.kentoj.kencommandapi.api.KenCommandApi;
import de.kentoj.kencommandapi.api.processing.CommandContext;
import de.kentoj.kencommandapi.api.processing.CommandException;
import de.kentoj.kencommandapi.api.processing.ParsedArgument;
import de.kentoj.kencommandapi.api.argument.ArgumentType;
import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.api.processing.CommandContext;
import de.kentoj.kencommandapi.api.processing.CommandException;
import de.kentoj.kencommandapi.api.processing.ParsedArgument;
import de.kentoj.kencommandapi.impl.processing.ParsedArgumentImpl;
import de.kentoj.kencommandapi.impl.structure.CommandArgumentImpl;
import de.kentoj.kencommandapi.impl.structure.CommandNodeImpl;
@ -16,7 +16,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Collectors;
@RequiredArgsConstructor
public abstract class AbstractKenCommandApi<T, S extends CommandContext<T, ?>> implements KenCommandApi<T, S> {

View file

@ -62,7 +62,7 @@ public class CommandNodeImpl<T, S extends CommandContext<T, ?>> implements Comma
if (arguments.stream()
.anyMatch(arg -> arg.getId().equals(argument.getId()))
) throw new IllegalArgumentException("argument with same identifier is already added");
if (arguments.getLast().getType().isGreedy())
if (!arguments.isEmpty() && arguments.getLast().getType().isGreedy())
throw new IllegalStateException("can't append argument to a node, whose last argument type is greedy: "
+ arguments.getLast().getType().getClass().getCanonicalName());