✨ Cleanup annotations and remove Cloud Brigs Pair (#32)
This commit is contained in:
parent
c3469706ab
commit
f1d4529276
10 changed files with 93 additions and 117 deletions
|
|
@ -30,8 +30,8 @@ import cloud.commandframework.meta.CommandMeta;
|
|||
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
|
|
@ -54,10 +54,10 @@ public class VelocityCommandManager<C> extends CommandManager<C> {
|
|||
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSource}
|
||||
*/
|
||||
public VelocityCommandManager(
|
||||
@Nonnull final ProxyServer proxyServer,
|
||||
@Nonnull final Function<CommandTree<C>, CommandExecutionCoordinator<C>> commandExecutionCoordinator,
|
||||
@Nonnull final Function<CommandSource, C> commandSenderMapper,
|
||||
@Nonnull final Function<C, CommandSource> backwardsCommandSenderMapper) {
|
||||
final @NonNull ProxyServer proxyServer,
|
||||
final @NonNull Function<@NonNull CommandTree<C>, @NonNull CommandExecutionCoordinator<C>> commandExecutionCoordinator,
|
||||
final @NonNull Function<@NonNull CommandSource, @NonNull C> commandSenderMapper,
|
||||
final @NonNull Function<@NonNull C, @NonNull CommandSource> backwardsCommandSenderMapper) {
|
||||
super(commandExecutionCoordinator, new VelocityPluginRegistrationHandler<>());
|
||||
((VelocityPluginRegistrationHandler<C>) this.getCommandRegistrationHandler()).initialize(this);
|
||||
this.proxyServer = proxyServer;
|
||||
|
|
@ -66,23 +66,20 @@ public class VelocityCommandManager<C> extends CommandManager<C> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPermission(@Nonnull final C sender, @Nonnull final String permission) {
|
||||
public final boolean hasPermission(final @NonNull C sender, final @NonNull String permission) {
|
||||
return this.backwardsCommandSenderMapper.apply(sender).hasPermission(permission);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final CommandMeta createDefaultCommandMeta() {
|
||||
public final @NonNull CommandMeta createDefaultCommandMeta() {
|
||||
return SimpleCommandMeta.empty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
final ProxyServer getProxyServer() {
|
||||
final @NonNull ProxyServer getProxyServer() {
|
||||
return this.proxyServer;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
final Function<CommandSource, C> getCommandSenderMapper() {
|
||||
final @NonNull Function<@NonNull CommandSource, @NonNull C> getCommandSenderMapper() {
|
||||
return this.commandSenderMapper;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ import com.velocitypowered.api.command.CommandMeta;
|
|||
import com.velocitypowered.api.command.CommandSource;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ final class VelocityPluginRegistrationHandler<C> implements CommandRegistrationH
|
|||
private CloudBrigadierManager<C, CommandSource> brigadierManager;
|
||||
private VelocityCommandManager<C> manager;
|
||||
|
||||
void initialize(@Nonnull final VelocityCommandManager<C> velocityCommandManager) {
|
||||
void initialize(final @NonNull VelocityCommandManager<C> velocityCommandManager) {
|
||||
this.manager = velocityCommandManager;
|
||||
this.brigadierManager = new CloudBrigadierManager<>(velocityCommandManager,
|
||||
() -> new CommandContext<>(
|
||||
|
|
@ -65,7 +65,7 @@ final class VelocityPluginRegistrationHandler<C> implements CommandRegistrationH
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean registerCommand(@Nonnull final Command<?> command) {
|
||||
public boolean registerCommand(final @NonNull Command<?> command) {
|
||||
final CommandArgument<?, ?> argument = command.getArguments().get(0);
|
||||
final List<String> aliases = ((StaticArgument<C>) argument).getAlternativeAliases();
|
||||
final BrigadierCommand brigadierCommand = new BrigadierCommand(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue