Reformat project
This commit is contained in:
parent
01d36aecd8
commit
237eda75ef
30 changed files with 130 additions and 87 deletions
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
name: Java CI with Maven
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
|||
|
|
@ -141,7 +141,8 @@ public final class AnnotationParser<C> {
|
|||
final A inner = getAnnotationRecursively(
|
||||
AnnotationAccessor.of(annotation.annotationType()),
|
||||
clazz,
|
||||
checkedAnnotations);
|
||||
checkedAnnotations
|
||||
);
|
||||
if (inner != null) {
|
||||
innerCandidate = inner;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class MethodCommandExecutionHandler<C> implements CommandExecutionHandler<C> {
|
|||
this.annotationAccessor
|
||||
);
|
||||
if (value != null) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value != null) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.lang.annotation.Target;
|
|||
* {@link cloud.commandframework.annotations.CommandMethod}
|
||||
* <p>
|
||||
* This should only be used on {@code String[]}
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
|
|
|
|||
|
|
@ -97,26 +97,31 @@ class AnnotationParserTest {
|
|||
final Method annotatedMethod = annotatedClass.getDeclaredMethod("annotatedMethod");
|
||||
|
||||
System.out.println("Looking for @CommandDescription");
|
||||
final CommandDescription commandDescription = AnnotationParser.getMethodOrClassAnnotation(annotatedMethod,
|
||||
CommandDescription.class);
|
||||
final CommandDescription commandDescription = AnnotationParser.getMethodOrClassAnnotation(
|
||||
annotatedMethod,
|
||||
CommandDescription.class
|
||||
);
|
||||
Assertions.assertNotNull(commandDescription);
|
||||
Assertions.assertEquals("Hello World!", commandDescription.value());
|
||||
|
||||
System.out.println("Looking for @CommandPermission");
|
||||
final CommandPermission commandPermission = AnnotationParser.getMethodOrClassAnnotation(annotatedMethod,
|
||||
CommandPermission.class);
|
||||
final CommandPermission commandPermission = AnnotationParser.getMethodOrClassAnnotation(
|
||||
annotatedMethod,
|
||||
CommandPermission.class
|
||||
);
|
||||
Assertions.assertNotNull(commandPermission);
|
||||
Assertions.assertEquals("some.permission", commandPermission.value());
|
||||
|
||||
System.out.println("Looking for @CommandMethod");
|
||||
final CommandMethod commandMethod = AnnotationParser.getMethodOrClassAnnotation(annotatedMethod,
|
||||
CommandMethod.class);
|
||||
final CommandMethod commandMethod = AnnotationParser.getMethodOrClassAnnotation(
|
||||
annotatedMethod,
|
||||
CommandMethod.class
|
||||
);
|
||||
Assertions.assertNotNull(commandMethod);
|
||||
Assertions.assertEquals("method", commandMethod.value());
|
||||
|
||||
System.out.println("Looking for @Regex");
|
||||
@SuppressWarnings("unused")
|
||||
final Regex regex = AnnotationParser.getMethodOrClassAnnotation(annotatedMethod, Regex.class);
|
||||
@SuppressWarnings("unused") final Regex regex = AnnotationParser.getMethodOrClassAnnotation(annotatedMethod, Regex.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -162,6 +167,7 @@ class AnnotationParserTest {
|
|||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface AnnotatedAnnotation {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -181,6 +187,7 @@ class AnnotationParserTest {
|
|||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface Bad1 {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -188,6 +195,7 @@ class AnnotationParserTest {
|
|||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface Bad2 {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -170,10 +170,10 @@ public final class CommandFlag<T> {
|
|||
}
|
||||
if (alias.length() > 1) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Alias '%s' has name longer than one character. This is not allowed",
|
||||
alias
|
||||
)
|
||||
String.format(
|
||||
"Alias '%s' has name longer than one character. This is not allowed",
|
||||
alias
|
||||
)
|
||||
);
|
||||
}
|
||||
filteredAliases.add(alias);
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
|
|||
inner = inputQueue.remove();
|
||||
if (inner.startsWith("\"") || inner.startsWith("'")) {
|
||||
return ArgumentParseResult.failure(new StringParseException(sj.toString(),
|
||||
StringMode.QUOTED, commandContext));
|
||||
StringMode.QUOTED, commandContext
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
|
|||
/**
|
||||
* Create a new required string array argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param name Argument name
|
||||
* @param suggestionsProvider Suggestions provider
|
||||
* @param <C> Command sender type
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull StringArrayArgument<C> of(
|
||||
|
|
@ -81,9 +81,9 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
|
|||
/**
|
||||
* Create a new optional string array argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param name Argument name
|
||||
* @param suggestionsProvider Suggestions provider
|
||||
* @param <C> Command sender type
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull StringArrayArgument<C> optional(
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ public interface CommandContextFactory<C> {
|
|||
boolean suggestions,
|
||||
@NonNull C sender,
|
||||
@NonNull CaptionRegistry<C> captionRegistry
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,37 +41,52 @@ public class CommandRegistrationStateTest {
|
|||
@Test
|
||||
void testRegistrationChangesState() {
|
||||
final TestCommandManager manager = new TestCommandManager();
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {}));
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {
|
||||
}));
|
||||
assertEquals(CommandManager.RegistrationState.REGISTERING, manager.getRegistrationState());
|
||||
// And a second registration maintains it
|
||||
manager.command(manager.commandBuilder("test2").handler(ctx -> {}));
|
||||
manager.command(manager.commandBuilder("test2").handler(ctx -> {
|
||||
}));
|
||||
assertEquals(CommandManager.RegistrationState.REGISTERING, manager.getRegistrationState());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChangingRegistrationHandlerFails() {
|
||||
final TestCommandManager manager = new TestCommandManager();
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {}));
|
||||
assertThrows(IllegalStateException.class,
|
||||
() -> manager.setCommandRegistrationHandler(CommandRegistrationHandler.nullCommandRegistrationHandler()));
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {
|
||||
}));
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> manager.setCommandRegistrationHandler(CommandRegistrationHandler.nullCommandRegistrationHandler())
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRegistrationFailsInAfterRegistrationState() {
|
||||
final TestCommandManager manager = new TestCommandManager();
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {}));
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {
|
||||
}));
|
||||
|
||||
manager.transitionOrThrow(CommandManager.RegistrationState.REGISTERING, CommandManager.RegistrationState.AFTER_REGISTRATION);
|
||||
assertThrows(IllegalStateException.class, () -> manager.command(manager.commandBuilder("test2").handler(ctx -> {})));
|
||||
manager.transitionOrThrow(
|
||||
CommandManager.RegistrationState.REGISTERING,
|
||||
CommandManager.RegistrationState.AFTER_REGISTRATION
|
||||
);
|
||||
assertThrows(IllegalStateException.class, () -> manager.command(manager.commandBuilder("test2").handler(ctx -> {
|
||||
})));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAllowUnsafeRegistration() {
|
||||
final TestCommandManager manager = new TestCommandManager();
|
||||
manager.setSetting(CommandManager.ManagerSettings.ALLOW_UNSAFE_REGISTRATION, true);
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {}));
|
||||
manager.transitionOrThrow(CommandManager.RegistrationState.REGISTERING, CommandManager.RegistrationState.AFTER_REGISTRATION);
|
||||
manager.command(manager.commandBuilder("unsafe").handler(ctx -> {}));
|
||||
manager.command(manager.commandBuilder("test").handler(ctx -> {
|
||||
}));
|
||||
manager.transitionOrThrow(
|
||||
CommandManager.RegistrationState.REGISTERING,
|
||||
CommandManager.RegistrationState.AFTER_REGISTRATION
|
||||
);
|
||||
manager.command(manager.commandBuilder("unsafe").handler(ctx -> {
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,8 +217,10 @@ public class CommandSuggestionsTest {
|
|||
Assertions.assertEquals(Arrays.asList("-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9"), suggestions3);
|
||||
final String input4 = "numbers -1";
|
||||
final List<String> suggestions4 = manager.suggest(new TestCommandSender(), input4);
|
||||
Assertions.assertEquals(Arrays.asList("-1", "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19"),
|
||||
suggestions4);
|
||||
Assertions.assertEquals(
|
||||
Arrays.asList("-1", "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19"),
|
||||
suggestions4
|
||||
);
|
||||
final String input5 = "numberswithmin ";
|
||||
final List<String> suggestions5 = manager.suggest(new TestCommandSender(), input5);
|
||||
Assertions.assertEquals(Arrays.asList("5", "6", "7", "8", "9"), suggestions5);
|
||||
|
|
@ -237,8 +239,10 @@ public class CommandSuggestionsTest {
|
|||
Assertions.assertEquals(Arrays.asList("-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9"), suggestions3);
|
||||
final String input4 = "numberswithfollowingargument -1";
|
||||
final List<String> suggestions4 = manager.suggest(new TestCommandSender(), input4);
|
||||
Assertions.assertEquals(Arrays.asList("-1", "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19"),
|
||||
suggestions4);
|
||||
Assertions.assertEquals(
|
||||
Arrays.asList("-1", "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19"),
|
||||
suggestions4
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ class CommandTreeTest {
|
|||
/* Build command for testing multiple optionals */
|
||||
manager.command(
|
||||
manager.commandBuilder("optionals")
|
||||
.argument(StringArgument.optional("opt1"))
|
||||
.argument(StringArgument.optional("opt2"))
|
||||
.argument(StringArgument.optional("opt1"))
|
||||
.argument(StringArgument.optional("opt2"))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ public class ParserRegistryTest {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof Range)) {
|
||||
return false;
|
||||
}
|
||||
final Range range = (Range) obj;
|
||||
return this.min().equals(range.min()) && this.max().equals(range.max());
|
||||
if (!(obj instanceof Range)) {
|
||||
return false;
|
||||
}
|
||||
final Range range = (Range) obj;
|
||||
return this.min().equals(range.min()) && this.max().equals(range.max());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -92,8 +92,10 @@ class StringArgumentTest {
|
|||
Assertions.assertEquals("quoted \" string", storage[0]);
|
||||
Assertions.assertEquals("unquoted", storage[1]);
|
||||
clear();
|
||||
Assertions.assertThrows(CompletionException.class, () -> manager.executeCommand(new TestCommandSender(),
|
||||
"'quoted quoted unquoted").join());
|
||||
Assertions.assertThrows(CompletionException.class, () -> manager.executeCommand(
|
||||
new TestCommandSender(),
|
||||
"'quoted quoted unquoted"
|
||||
).join());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
dependencies {
|
||||
api project(':cloud-core')
|
||||
implementation "com.github.pircbotx:pircbotx:${vers['pircbotx']}"
|
||||
api project(':cloud-core')
|
||||
implementation "com.github.pircbotx:pircbotx:${vers['pircbotx']}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
|
|||
/**
|
||||
* Create a new argument builder
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Builder instance
|
||||
*/
|
||||
public static <C> @NonNull Builder<C> newBuilder(
|
||||
|
|
@ -93,8 +93,8 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
|
|||
/**
|
||||
* Create a new required argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, Location> of(
|
||||
|
|
@ -108,8 +108,8 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
|
|||
/**
|
||||
* Create a new optional argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, Location> optional(
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.util.LinkedList;
|
|||
|
||||
/**
|
||||
* Bungee specific {@link Caption caption keys}
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public final class BungeeCaptionKeys {
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
|
|||
/**
|
||||
* Create a new argument builder
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed builder
|
||||
**/
|
||||
public static <C> CommandArgument.@NonNull Builder<C, ProxiedPlayer> newBuilder(
|
||||
|
|
@ -90,8 +90,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
|
|||
/**
|
||||
* Create a new required player argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> CommandArgument<C, ProxiedPlayer> of(
|
||||
|
|
@ -103,8 +103,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
|
|||
/**
|
||||
* Create a new optional player argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> CommandArgument<C, ProxiedPlayer> optional(
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
|
|||
/**
|
||||
* Create a new argument builder
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed builder
|
||||
*/
|
||||
public static <C> CommandArgument.@NonNull Builder<C, ServerInfo> newBuilder(
|
||||
|
|
@ -90,8 +90,8 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
|
|||
/**
|
||||
* Create a new required server argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, ServerInfo> of(
|
||||
|
|
@ -103,8 +103,8 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
|
|||
/**
|
||||
* Create a new optional server argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, ServerInfo> optional(
|
||||
|
|
|
|||
|
|
@ -117,10 +117,12 @@ public class CloudburstCommandManager<C> extends CommandManager<C> {
|
|||
}
|
||||
|
||||
static final class CloudListener implements Listener {
|
||||
|
||||
static final CloudListener INSTANCE = new CloudListener();
|
||||
|
||||
private CloudListener() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class PaperBrigadierListener<C> implements Listener {
|
|||
)
|
||||
);
|
||||
this.brigadierManager.brigadierSenderMapper(
|
||||
sender -> this.paperCommandManager.getCommandSenderMapper().apply(sender.getBukkitSender())
|
||||
sender -> this.paperCommandManager.getCommandSenderMapper().apply(sender.getBukkitSender())
|
||||
);
|
||||
new BukkitBrigadierMapper<>(this.paperCommandManager, this.brigadierManager);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,18 +71,23 @@ public final class CloudInjectionModule<C> extends AbstractModule {
|
|||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected void configure() {
|
||||
final Type commandTreeType = Types.newParameterizedType(CommandTree.class, this.commandSenderType);
|
||||
final Type commandExecutionCoordinatorType = Types.newParameterizedType(CommandExecutionCoordinator.class,
|
||||
this.commandSenderType);
|
||||
final Type commandExecutionCoordinatorType = Types.newParameterizedType(
|
||||
CommandExecutionCoordinator.class,
|
||||
this.commandSenderType
|
||||
);
|
||||
final Type executorFunction = Types.newParameterizedType(Function.class, commandTreeType,
|
||||
commandExecutionCoordinatorType);
|
||||
commandExecutionCoordinatorType
|
||||
);
|
||||
final Key executorFunctionKey = Key.get(executorFunction);
|
||||
this.bind(executorFunctionKey).toInstance(this.commandExecutionCoordinator);
|
||||
final Type commandSenderMapperFunction = Types.newParameterizedType(Function.class, CommandSource.class,
|
||||
this.commandSenderType);
|
||||
this.commandSenderType
|
||||
);
|
||||
final Key commandSenderMapperFunctionKey = Key.get(commandSenderMapperFunction);
|
||||
this.bind(commandSenderMapperFunctionKey).toInstance(this.commandSenderMapper);
|
||||
final Type backwardsCommandSenderMapperFunction = Types.newParameterizedType(Function.class, this.commandSenderType,
|
||||
CommandSource.class);
|
||||
CommandSource.class
|
||||
);
|
||||
final Key backwardsCommandSenderMapperFunctionKey = Key.get(backwardsCommandSenderMapperFunction);
|
||||
this.bind(backwardsCommandSenderMapperFunctionKey).toInstance(this.backwardsCommandSenderMapper);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.util.LinkedList;
|
|||
|
||||
/**
|
||||
* Velocity specific {@link Caption caption keys}
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public final class VelocityCaptionKeys {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ public class VelocityCommandManager<C> extends CommandManager<C> implements Brig
|
|||
private final ProxyServer proxyServer;
|
||||
private final Function<CommandSource, C> commandSenderMapper;
|
||||
private final Function<C, CommandSource> backwardsCommandSenderMapper;
|
||||
|
||||
/**
|
||||
* Create a new command manager instance.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ final class VelocityExecutor<C> implements Command<CommandSource> {
|
|||
e.getCorrectSyntax(),
|
||||
NamedTextColor.GRAY
|
||||
)
|
||||
).build())
|
||||
).build()
|
||||
)
|
||||
);
|
||||
} else if (throwable instanceof InvalidCommandSenderException) {
|
||||
this.manager.handleException(
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
|||
/**
|
||||
* Create a new argument builder
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed builder
|
||||
*/
|
||||
public static <C> CommandArgument.@NonNull Builder<C, Player> newBuilder(
|
||||
|
|
@ -90,8 +90,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
|||
/**
|
||||
* Create a new required player argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, Player> of(
|
||||
|
|
@ -103,8 +103,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
|||
/**
|
||||
* Create a new optional player argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, Player> optional(
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ public final class ServerArgument<C> extends CommandArgument<C, RegisteredServer
|
|||
/**
|
||||
* Create a new argument builder
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Constructed builder
|
||||
*/
|
||||
public static <C> CommandArgument.@NonNull Builder<C, RegisteredServer> newBuilder(
|
||||
|
|
@ -90,8 +90,8 @@ public final class ServerArgument<C> extends CommandArgument<C, RegisteredServer
|
|||
/**
|
||||
* Create a new required player argument
|
||||
*
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @param name Argument name
|
||||
* @param <C> Command sender type
|
||||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, RegisteredServer> of(
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ name: ExamplePlugin
|
|||
version: 1.2.0-SNAPSHOT
|
||||
api-version: 1.13
|
||||
main: cloud.commandframework.examples.bukkit.ExamplePlugin
|
||||
depends: [Essentials]
|
||||
depends: [ Essentials ]
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public final class PrivateUser extends CustomUser {
|
|||
/**
|
||||
* Construct a Private user
|
||||
*
|
||||
* @param user User that sent the message
|
||||
* @param user User that sent the message
|
||||
* @param channel Text channel that the message was sent in
|
||||
*/
|
||||
public PrivateUser(final @NonNull User user, final @NonNull PrivateChannel channel) {
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ public final class ExampleVelocityPlugin {
|
|||
);
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder("example-server")
|
||||
.argument(ServerArgument.of("server"))
|
||||
.handler(context -> {
|
||||
.argument(ServerArgument.of("server"))
|
||||
.handler(context -> {
|
||||
final RegisteredServer server = context.get("server");
|
||||
context.getSender().sendMessage(
|
||||
Identity.nil(),
|
||||
|
|
@ -103,7 +103,7 @@ public final class ExampleVelocityPlugin {
|
|||
Component.text(server.getServerInfo().getName(), NamedTextColor.AQUA)
|
||||
).build()
|
||||
);
|
||||
})
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue