⚡ Some small changes
This commit is contained in:
parent
26f11e3a7e
commit
f7c00244e7
6 changed files with 18 additions and 26 deletions
|
|
@ -31,7 +31,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -89,8 +88,8 @@ class CommandHelpHandlerTest {
|
|||
this.printTopic("vec", query4);
|
||||
}
|
||||
|
||||
private void printTopic(@Nonnull final String query,
|
||||
@Nonnull final CommandHelpHandler.HelpTopic<TestCommandSender> helpTopic) {
|
||||
private void printTopic(final String query,
|
||||
final CommandHelpHandler.HelpTopic<TestCommandSender> helpTopic) {
|
||||
System.out.printf("Showing results for query: \"/%s\"\n", query);
|
||||
if (helpTopic instanceof CommandHelpHandler.IndexHelpTopic) {
|
||||
this.printIndexHelpTopic((CommandHelpHandler.IndexHelpTopic<TestCommandSender>) helpTopic);
|
||||
|
|
@ -104,7 +103,7 @@ class CommandHelpHandlerTest {
|
|||
System.out.println();
|
||||
}
|
||||
|
||||
private void printIndexHelpTopic(@Nonnull final CommandHelpHandler.IndexHelpTopic<TestCommandSender> helpTopic) {
|
||||
private void printIndexHelpTopic(final CommandHelpHandler.IndexHelpTopic<TestCommandSender> helpTopic) {
|
||||
System.out.println("└── Available Commands: ");
|
||||
final Iterator<CommandHelpHandler.VerboseHelpEntry<TestCommandSender>> iterator = helpTopic.getEntries().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
|
@ -114,7 +113,7 @@ class CommandHelpHandlerTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void printMultiHelpTopic(@Nonnull final CommandHelpHandler.MultiHelpTopic<TestCommandSender> helpTopic) {
|
||||
private void printMultiHelpTopic(final CommandHelpHandler.MultiHelpTopic<TestCommandSender> helpTopic) {
|
||||
System.out.printf("└── /%s\n", helpTopic.getLongestPath());
|
||||
final int headerIndentation = helpTopic.getLongestPath().length();
|
||||
final Iterator<String> iterator = helpTopic.getChildSuggestions().iterator();
|
||||
|
|
@ -134,7 +133,7 @@ class CommandHelpHandlerTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void printVerboseHelpTopic(@Nonnull final CommandHelpHandler.VerboseHelpTopic<TestCommandSender> helpTopic) {
|
||||
private void printVerboseHelpTopic(final CommandHelpHandler.VerboseHelpTopic<TestCommandSender> helpTopic) {
|
||||
System.out.printf("└── Command: /%s\n", manager.getCommandSyntaxFormatter()
|
||||
.apply(helpTopic.getCommand().getArguments(), null));
|
||||
System.out.printf(" ├── Description: %s\n", helpTopic.getDescription());
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
package cloud.commandframework.bukkit;
|
||||
|
||||
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class BukkitCommandMeta extends SimpleCommandMeta {
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ public class BukkitCommandMeta extends SimpleCommandMeta {
|
|||
*
|
||||
* @param simpleCommandMeta Simple command meta data instance that gets mirrored
|
||||
*/
|
||||
public BukkitCommandMeta(@Nonnull final SimpleCommandMeta simpleCommandMeta) {
|
||||
public BukkitCommandMeta(@NonNull final SimpleCommandMeta simpleCommandMeta) {
|
||||
super(simpleCommandMeta.getAll());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
package cloud.commandframework.bukkit;
|
||||
|
||||
import cloud.commandframework.meta.CommandMeta;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class BukkitCommandMetaBuilder {
|
||||
|
||||
|
|
@ -37,8 +36,7 @@ public final class BukkitCommandMetaBuilder {
|
|||
*
|
||||
* @return Builder instance
|
||||
*/
|
||||
@Nonnull
|
||||
public static BuilderStage1 builder() {
|
||||
public static @NonNull BuilderStage1 builder() {
|
||||
return new BuilderStage1();
|
||||
}
|
||||
|
||||
|
|
@ -54,8 +52,7 @@ public final class BukkitCommandMetaBuilder {
|
|||
* @param description Command description
|
||||
* @return Builder instance
|
||||
*/
|
||||
@Nonnull
|
||||
public BuilderStage2 withDescription(@Nonnull final String description) {
|
||||
public @NonNull BuilderStage2 withDescription(@NonNull final String description) {
|
||||
return new BuilderStage2(description);
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +63,7 @@ public final class BukkitCommandMetaBuilder {
|
|||
|
||||
private final String description;
|
||||
|
||||
private BuilderStage2(@Nonnull final String description) {
|
||||
private BuilderStage2(@NonNull final String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +72,7 @@ public final class BukkitCommandMetaBuilder {
|
|||
*
|
||||
* @return Meta instance
|
||||
*/
|
||||
@Nonnull
|
||||
public BukkitCommandMeta build() {
|
||||
public @NonNull BukkitCommandMeta build() {
|
||||
return new BukkitCommandMeta(CommandMeta.simple().with("description", this.description).build());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ package cloud.commandframework.bukkit;
|
|||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
final class BukkitConsoleSender extends BukkitCommandSender {
|
||||
|
||||
|
|
@ -39,9 +38,8 @@ final class BukkitConsoleSender extends BukkitCommandSender {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Player asPlayer() {
|
||||
public @NonNull Player asPlayer() {
|
||||
throw new UnsupportedOperationException("Cannot convert console to player");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.help.GenericCommandHelpTopic;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
|
|
@ -51,7 +51,7 @@ class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHandler {
|
|||
BukkitPluginRegistrationHandler() {
|
||||
}
|
||||
|
||||
void initialize(@Nonnull final BukkitCommandManager<C> bukkitCommandManager) throws Exception {
|
||||
void initialize(@NonNull final BukkitCommandManager<C> bukkitCommandManager) throws Exception {
|
||||
final Method getCommandMap = Bukkit.getServer().getClass().getDeclaredMethod("getCommandMap");
|
||||
getCommandMap.setAccessible(true);
|
||||
this.commandMap = (CommandMap) getCommandMap.invoke(Bukkit.getServer());
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.services.annotations.ServiceImplementation;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
@ -53,7 +53,7 @@ enum AnnotatedMethodServiceFactory {
|
|||
|
||||
}
|
||||
map.put(new AnnotatedMethodService<>(instance, method),
|
||||
TypeToken.get(serviceImplementation.value()));
|
||||
TypeToken.get(serviceImplementation.value()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue