restructure dirs + add rawInput parameter at ArgumentType#checkValue
This commit is contained in:
parent
aae7a160ac
commit
f1e9ac5ea9
29 changed files with 85 additions and 81 deletions
|
|
@ -8,7 +8,7 @@ import de.kentoj.scrow.bukkit.cmds2.CommandFactoryImpl;
|
|||
import de.kentoj.scrow.bukkit.cmds2.bukkit.BukkitCommandManager;
|
||||
import de.kentoj.scrow.bukkit.economy.InMemoryEconomyService;
|
||||
import de.kentoj.scrow.bukkit.economy.MongoEconomyService;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.Commands;
|
||||
import de.kentoj.scrow.bukkit.services.command.Commands;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.bson.UuidRepresentation;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.SuggestionProvider;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.SuggestionProvider;
|
||||
import de.kentoj.scrow.bukkit.services.command.type.ArgumentType;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.exception.CommandInvocationException;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandFactory;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.Literal;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.CommandFactory;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.Literal;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.type.ArgumentType;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.CommandExecutor;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.Literal;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.CommandExecutor;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.Literal;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package de.kentoj.scrow.bukkit.cmds2.bukkit;
|
|||
|
||||
import de.kentoj.scrow.bukkit.cmds2.parsing.ArgumentReaderImpl;
|
||||
import de.kentoj.scrow.bukkit.cmds2.parsing.CommandProcessor;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.exception.CommandInvocationException;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2.bukkit;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.CommandManager;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2.bukkit;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2.parsing;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import lombok.Value;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
|
@ -9,5 +9,5 @@ import org.jetbrains.annotations.Nullable;
|
|||
public class ArgumentDataImpl<T> implements ArgumentData<T> {
|
||||
T value;
|
||||
CommandArgument<T> argument;
|
||||
@Nullable String rawValue;
|
||||
@Nullable String rawInput;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2.parsing;
|
||||
|
||||
import de.kentoj.scrow.bukkit.services.command.ArgumentReader;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.ArgumentReader;
|
||||
import de.kentoj.scrow.bukkit.services.command.exception.CommandInvocationException;
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package de.kentoj.scrow.bukkit.cmds2.parsing;
|
||||
|
||||
import de.kentoj.scrow.bukkit.cmds2.CommandContextImpl;
|
||||
import de.kentoj.scrow.bukkit.services.command.ArgumentReader;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.Literal;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.ArgumentReader;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.ArgumentData;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.Literal;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.exception.CommandInvocationException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
|
@ -60,9 +60,9 @@ public class CommandProcessor {
|
|||
return new ArgumentDataImpl<>(defaultValue, argument, null);
|
||||
}
|
||||
|
||||
final var rawValue = argument.getType().readRawInput(argumentReader);
|
||||
T value = argument.getType().parseInput(rawValue);
|
||||
argument.getType().checkValue(new CommandContextImpl(sender, arguments), value);
|
||||
return new ArgumentDataImpl<>(value, argument, rawValue);
|
||||
final var rawInput = argument.getType().readRawInput(argumentReader);
|
||||
T value = argument.getType().parseInput(rawInput);
|
||||
argument.getType().checkValue(new CommandContextImpl(sender, arguments), value, rawInput);
|
||||
return new ArgumentDataImpl<>(value, argument, rawInput);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package de.kentoj.scrow.bukkit.economy.command;
|
||||
|
||||
import de.kentoj.scrow.bukkit.ScrowAPI;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.Commands;
|
||||
import de.kentoj.scrow.bukkit.services.command.cmds2.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.CommandArgument;
|
||||
import de.kentoj.scrow.bukkit.services.command.execution.CommandContext;
|
||||
import de.kentoj.scrow.bukkit.services.command.Commands;
|
||||
import de.kentoj.scrow.bukkit.services.command.literal.RootLiteral;
|
||||
import de.kentoj.scrow.bukkit.services.command.type.NumberArgumentType;
|
||||
import de.kentoj.scrow.bukkit.services.command.type.PlayerArgumentType;
|
||||
import org.bukkit.Bukkit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue