Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 25, 2024
1 parent 7949f56 commit 0a7bf24
Show file tree
Hide file tree
Showing 38 changed files with 256 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.SenderMapper;
import cloud.commandframework.execution.ExecutionCoordinator;
import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.util.Types;
import java.lang.reflect.Type;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.SenderMapper;
import org.incendo.cloud.execution.ExecutionCoordinator;
import org.spongepowered.api.command.CommandCause;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.CommandComponent;
import cloud.commandframework.arguments.LiteralParser;
import cloud.commandframework.arguments.aggregate.AggregateParser;
import cloud.commandframework.internal.CommandNode;
import cloud.commandframework.permission.Permission;
import cloud.commandframework.types.tuples.Pair;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.List;
Expand All @@ -37,6 +31,12 @@
import java.util.stream.Collectors;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.component.CommandComponent;
import org.incendo.cloud.internal.CommandNode;
import org.incendo.cloud.parser.aggregate.AggregateParser;
import org.incendo.cloud.parser.standard.LiteralParser;
import org.incendo.cloud.permission.Permission;
import org.incendo.cloud.type.tuple.Pair;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.command.CommandCompletion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.arguments.parser.ArgumentParser;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.api.command.registrar.tree.CommandTreeNode;

/**
* Implemented by {@link ArgumentParser} which also supply a special {@link CommandTreeNode.Argument}.
* Implemented by {@link org.incendo.cloud.parser.ArgumentParser} which also supply a special {@link CommandTreeNode.Argument}.
*/
public interface NodeSource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.captions.Caption;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.caption.Caption;

/**
* {@link Caption} instances for messages in cloud-sponge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.keys.CloudKey;
import io.leangen.geantyref.TypeToken;
import org.incendo.cloud.key.CloudKey;
import org.spongepowered.api.command.CommandCause;

/**
* Sponge related {@link cloud.commandframework.context.CommandContext} keys.
* Sponge related {@link org.incendo.cloud.context.CommandContext} keys.
*/
public final class SpongeCommandContextKeys {

/**
* The Sponge native {@link org.spongepowered.api.command.CommandCause} instance is stored in the {@link cloud.commandframework.context.CommandContext}
* The Sponge native {@link org.spongepowered.api.command.CommandCause} instance is stored in the {@link org.incendo.cloud.context.CommandContext}
* by {@link SpongeCommandPreprocessor}
*/
public static final CloudKey<CommandCause> COMMAND_CAUSE = CloudKey.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,11 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.CommandManager;
import cloud.commandframework.SenderMapper;
import cloud.commandframework.SenderMapperHolder;
import cloud.commandframework.arguments.parser.ParserParameters;
import cloud.commandframework.arguments.suggestion.SuggestionFactory;
import cloud.commandframework.execution.ExecutionCoordinator;
import cloud.commandframework.meta.CommandMeta;
import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.sponge.annotation.specifier.Center;
import cloud.commandframework.sponge.parser.RegistryEntryParser;
import cloud.commandframework.sponge.parser.Vector2dParser;
import cloud.commandframework.sponge.parser.Vector3dParser;
import cloud.commandframework.sponge.suggestion.SpongeSuggestion;
import cloud.commandframework.state.RegistrationState;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
import com.google.inject.Module;
Expand All @@ -48,6 +39,15 @@
import java.util.Set;
import java.util.function.Consumer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.CommandManager;
import org.incendo.cloud.SenderMapper;
import org.incendo.cloud.SenderMapperHolder;
import org.incendo.cloud.execution.ExecutionCoordinator;
import org.incendo.cloud.meta.CommandMeta;
import org.incendo.cloud.meta.SimpleCommandMeta;
import org.incendo.cloud.parser.ParserParameters;
import org.incendo.cloud.state.RegistrationState;
import org.incendo.cloud.suggestion.SuggestionFactory;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.event.lifecycle.RegisterCommandEvent;
Expand Down Expand Up @@ -231,7 +231,7 @@ public boolean hasPermission(

/**
* Get the {@link SpongeParserMapper}, responsible for mapping Cloud
* {@link cloud.commandframework.arguments.parser.ArgumentParser ArgumentParser} to Sponge
* {@link org.incendo.cloud.parser.ArgumentParser ArgumentParser} to Sponge
* {@link org.spongepowered.api.command.registrar.tree.CommandTreeNode.Argument CommandTreeNode.Arguments}.
*
* @return the parser mapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.brigadier.parser.WrappedBrigadierParser;
import cloud.commandframework.execution.preprocessor.CommandPreprocessingContext;
import cloud.commandframework.execution.preprocessor.CommandPreprocessor;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.brigadier.parser.WrappedBrigadierParser;
import org.incendo.cloud.execution.preprocessor.CommandPreprocessingContext;
import org.incendo.cloud.execution.preprocessor.CommandPreprocessor;
import org.spongepowered.api.command.CommandCause;

/**
* Command preprocessor which decorates incoming {@link cloud.commandframework.context.CommandContext}
* Command preprocessor which decorates incoming {@link org.incendo.cloud.context.CommandContext}
* with Sponge specific objects
*
* @param <C> Command sender type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.captions.CaptionProvider;
import cloud.commandframework.captions.DelegatingCaptionProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.caption.CaptionProvider;
import org.incendo.cloud.caption.DelegatingCaptionProvider;

/**
* Provides the default captions for messages in cloud-sponge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.exceptions.ArgumentParseException;
import cloud.commandframework.exceptions.CommandExecutionException;
import cloud.commandframework.exceptions.InvalidCommandSenderException;
import cloud.commandframework.exceptions.InvalidSyntaxException;
import cloud.commandframework.exceptions.NoPermissionException;
import cloud.commandframework.exceptions.NoSuchCommandException;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.util.ComponentMessageThrowable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.incendo.cloud.exception.ArgumentParseException;
import org.incendo.cloud.exception.CommandExecutionException;
import org.incendo.cloud.exception.InvalidCommandSenderException;
import org.incendo.cloud.exception.InvalidSyntaxException;
import org.incendo.cloud.exception.NoPermissionException;
import org.incendo.cloud.exception.NoSuchCommandException;

import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.NamedTextColor.GRAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.CommandComponent;
import cloud.commandframework.arguments.flags.CommandFlagParser;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.parser.MappedArgumentParser;
import cloud.commandframework.arguments.standard.BooleanParser;
import cloud.commandframework.arguments.standard.ByteParser;
import cloud.commandframework.arguments.standard.DoubleParser;
import cloud.commandframework.arguments.standard.FloatParser;
import cloud.commandframework.arguments.standard.IntegerParser;
import cloud.commandframework.arguments.standard.LongParser;
import cloud.commandframework.arguments.standard.ShortParser;
import cloud.commandframework.arguments.standard.StringArrayParser;
import cloud.commandframework.arguments.standard.StringParser;
import cloud.commandframework.arguments.standard.UUIDParser;
import io.leangen.geantyref.GenericTypeReflector;
import io.leangen.geantyref.TypeToken;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.component.CommandComponent;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.MappedArgumentParser;
import org.incendo.cloud.parser.flag.CommandFlagParser;
import org.incendo.cloud.parser.standard.BooleanParser;
import org.incendo.cloud.parser.standard.ByteParser;
import org.incendo.cloud.parser.standard.DoubleParser;
import org.incendo.cloud.parser.standard.FloatParser;
import org.incendo.cloud.parser.standard.IntegerParser;
import org.incendo.cloud.parser.standard.LongParser;
import org.incendo.cloud.parser.standard.ShortParser;
import org.incendo.cloud.parser.standard.StringArrayParser;
import org.incendo.cloud.parser.standard.StringParser;
import org.incendo.cloud.parser.standard.UUIDParser;
import org.spongepowered.api.command.registrar.tree.CommandTreeNode;
import org.spongepowered.api.command.registrar.tree.CommandTreeNodeTypes;

import static java.util.Objects.requireNonNull;

/**
* Class responsible for mapping Cloud {@link ArgumentParser ArgumentParsers} to Sponge
* Class responsible for mapping Cloud {@link org.incendo.cloud.parser.ArgumentParser ArgumentParsers} to Sponge
* {@link CommandTreeNode.Argument CommandTreeNode.Arguments}.
*
* @param <C> command sender type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.arguments.parser.ParserParameter;
import io.leangen.geantyref.TypeToken;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.parser.ParserParameter;

/**
* {@link ParserParameter} keys for cloud-sponge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
//
package cloud.commandframework.sponge;

import cloud.commandframework.CommandComponent;
import cloud.commandframework.arguments.aggregate.AggregateParser;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.parser.EitherParser;
import cloud.commandframework.arguments.parser.MappedArgumentParser;
import cloud.commandframework.brigadier.parser.WrappedBrigadierParser;
import cloud.commandframework.internal.CommandNode;
import cloud.commandframework.internal.CommandRegistrationHandler;
import cloud.commandframework.minecraft.modded.internal.ContextualArgumentTypeProvider;
import io.leangen.geantyref.TypeToken;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.server.MinecraftServer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.brigadier.parser.WrappedBrigadierParser;
import org.incendo.cloud.component.CommandComponent;
import org.incendo.cloud.internal.CommandNode;
import org.incendo.cloud.internal.CommandRegistrationHandler;
import org.incendo.cloud.minecraft.modded.internal.ContextualArgumentTypeProvider;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.MappedArgumentParser;
import org.incendo.cloud.parser.aggregate.AggregateParser;
import org.incendo.cloud.parser.standard.EitherParser;
import org.spongepowered.api.Server;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.Command;
Expand All @@ -51,7 +51,7 @@
final class SpongeRegistrationHandler<C> implements CommandRegistrationHandler<C> {

private SpongeCommandManager<C> commandManager;
private final Set<cloud.commandframework.Command<C>> registeredCommands = new HashSet<>();
private final Set<org.incendo.cloud.Command<C>> registeredCommands = new HashSet<>();

SpongeRegistrationHandler() {
}
Expand Down Expand Up @@ -80,7 +80,7 @@ private void startedEngine(final StartedEngineEvent<Server> serverStartedEngineE
CommandBuildContext.configurable(engine.registryAccess(), engine.getWorldData().enabledFeatures()),
true,
() -> {
for (final cloud.commandframework.Command<C> registeredCommand : this.registeredCommands) {
for (final org.incendo.cloud.Command<C> registeredCommand : this.registeredCommands) {
for (final CommandComponent<C> component : registeredCommand.components()) {
if (component.type() == CommandComponent.ComponentType.LITERAL
|| component.type() == CommandComponent.ComponentType.FLAG) {
Expand Down Expand Up @@ -117,7 +117,7 @@ void initialize(final @NonNull SpongeCommandManager<C> commandManager) {
}

@Override
public boolean registerCommand(final cloud.commandframework.@NonNull Command<C> command) {
public boolean registerCommand(final org.incendo.cloud.@NonNull Command<C> command) {
this.registeredCommands.add(command);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
//
package cloud.commandframework.sponge.parser;

import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.parser.ParserDescriptor;
import cloud.commandframework.arguments.suggestion.Suggestion;
import cloud.commandframework.arguments.suggestion.SuggestionProvider;
import cloud.commandframework.brigadier.parser.WrappedBrigadierParser;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.context.CommandInput;
import cloud.commandframework.minecraft.modded.internal.ContextualArgumentTypeProvider;
import cloud.commandframework.sponge.NodeSource;
import cloud.commandframework.sponge.data.BlockInput;
import java.lang.reflect.Field;
Expand All @@ -42,6 +33,15 @@
import net.minecraft.server.level.ServerLevel;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.incendo.cloud.brigadier.parser.WrappedBrigadierParser;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.incendo.cloud.minecraft.modded.internal.ContextualArgumentTypeProvider;
import org.incendo.cloud.parser.ArgumentParseResult;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.ParserDescriptor;
import org.incendo.cloud.suggestion.Suggestion;
import org.incendo.cloud.suggestion.SuggestionProvider;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.command.registrar.tree.CommandTreeNode;
import org.spongepowered.api.command.registrar.tree.CommandTreeNodeTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@
//
package cloud.commandframework.sponge.parser;

import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.parser.ParserDescriptor;
import cloud.commandframework.arguments.suggestion.Suggestion;
import cloud.commandframework.arguments.suggestion.SuggestionProvider;
import cloud.commandframework.brigadier.parser.WrappedBrigadierParser;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.context.CommandInput;
import cloud.commandframework.minecraft.modded.internal.ContextualArgumentTypeProvider;
import cloud.commandframework.sponge.NodeSource;
import cloud.commandframework.sponge.data.BlockPredicate;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.brigadier.parser.WrappedBrigadierParser;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.incendo.cloud.minecraft.modded.internal.ContextualArgumentTypeProvider;
import org.incendo.cloud.parser.ArgumentParseResult;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.ParserDescriptor;
import org.incendo.cloud.suggestion.Suggestion;
import org.incendo.cloud.suggestion.SuggestionProvider;
import org.spongepowered.api.command.registrar.tree.CommandTreeNode;
import org.spongepowered.api.command.registrar.tree.CommandTreeNodeTypes;
import org.spongepowered.api.world.server.ServerLocation;
Expand All @@ -63,7 +64,7 @@ public static <C> ParserDescriptor<C, BlockPredicate> blockPredicateParser() {
}

private final ArgumentParser<C, BlockPredicate> mappedParser =
new WrappedBrigadierParser<C, net.minecraft.commands.arguments.blocks.BlockPredicateArgument.Result>(
new WrappedBrigadierParser<C, BlockPredicateArgument.Result>(
new ContextualArgumentTypeProvider<>(net.minecraft.commands.arguments.blocks.BlockPredicateArgument::blockPredicate)
).flatMapSuccess((ctx, result) -> ArgumentParseResult.successFuture(new BlockPredicateImpl(result)));

Expand Down
Loading

0 comments on commit 0a7bf24

Please sign in to comment.