🚚 More removal of javax annotations
This commit is contained in:
parent
4556b392b0
commit
26f11e3a7e
47 changed files with 594 additions and 691 deletions
|
|
@ -34,8 +34,8 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
||||
|
|
@ -51,11 +51,11 @@ final class BukkitCommand<C> extends org.bukkit.command.Command implements Plugi
|
|||
private final Command<C> cloudCommand;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
BukkitCommand(@Nonnull final String label,
|
||||
@Nonnull final List<String> aliases,
|
||||
@Nonnull final Command<C> cloudCommand,
|
||||
@Nonnull final CommandArgument<C, ?> command,
|
||||
@Nonnull final BukkitCommandManager<C> manager) {
|
||||
BukkitCommand(@NonNull final String label,
|
||||
@NonNull final List<@NonNull String> aliases,
|
||||
@NonNull final Command<C> cloudCommand,
|
||||
@NonNull final CommandArgument<C, ?> command,
|
||||
@NonNull final BukkitCommandManager<C> manager) {
|
||||
super(label,
|
||||
cloudCommand.getCommandMeta().getOrDefault("description", ""),
|
||||
"",
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ import org.bukkit.Material;
|
|||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -71,11 +71,11 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender}
|
||||
* @throws Exception If the construction of the manager fails
|
||||
*/
|
||||
public BukkitCommandManager(@Nonnull final Plugin owningPlugin,
|
||||
@Nonnull final Function<CommandTree<C>,
|
||||
CommandExecutionCoordinator<C>> commandExecutionCoordinator,
|
||||
@Nonnull final Function<CommandSender, C> commandSenderMapper,
|
||||
@Nonnull final Function<C, CommandSender> backwardsCommandSenderMapper)
|
||||
public BukkitCommandManager(@NonNull final Plugin owningPlugin,
|
||||
@NonNull final Function<@NonNull CommandTree<C>,
|
||||
@NonNull CommandExecutionCoordinator<C>> commandExecutionCoordinator,
|
||||
@NonNull final Function<@NonNull CommandSender, @NonNull C> commandSenderMapper,
|
||||
@NonNull final Function<@NonNull C, @NonNull CommandSender> backwardsCommandSenderMapper)
|
||||
throws Exception {
|
||||
super(commandExecutionCoordinator, new BukkitPluginRegistrationHandler<>());
|
||||
((BukkitPluginRegistrationHandler<C>) this.getCommandRegistrationHandler()).initialize(this);
|
||||
|
|
@ -117,8 +117,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return Owning plugin
|
||||
*/
|
||||
@Nonnull
|
||||
public Plugin getOwningPlugin() {
|
||||
public @NonNull Plugin getOwningPlugin() {
|
||||
return this.owningPlugin;
|
||||
}
|
||||
|
||||
|
|
@ -127,9 +126,8 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return Meta data
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public BukkitCommandMeta createDefaultCommandMeta() {
|
||||
public @NonNull BukkitCommandMeta createDefaultCommandMeta() {
|
||||
return BukkitCommandMetaBuilder.builder().withDescription("").build();
|
||||
}
|
||||
|
||||
|
|
@ -138,13 +136,12 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return Command sender mapper
|
||||
*/
|
||||
@Nonnull
|
||||
public final Function<CommandSender, C> getCommandSenderMapper() {
|
||||
public final @NonNull Function<@NonNull CommandSender, @NonNull C> getCommandSenderMapper() {
|
||||
return this.commandSenderMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPermission(@Nonnull final C sender, @Nonnull final String permission) {
|
||||
public final boolean hasPermission(@NonNull final C sender, @NonNull final String permission) {
|
||||
if (permission.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -172,7 +169,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
* @param capability Capability
|
||||
* @return {@code true} if the manager has the given capability, else {@code false}
|
||||
*/
|
||||
public final boolean queryCapability(@Nonnull final CloudBukkitCapabilities capability) {
|
||||
public final boolean queryCapability(@NonNull final CloudBukkitCapabilities capability) {
|
||||
return this.queryCapabilities().contains(capability);
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +178,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return A set containing all capabilities of the instance
|
||||
*/
|
||||
public final Set<CloudBukkitCapabilities> queryCapabilities() {
|
||||
public final @NonNull Set<@NonNull CloudBukkitCapabilities> queryCapabilities() {
|
||||
if (this.paper) {
|
||||
if (this.minecraftVersion >= BRIGADIER_MINIMAL_VERSION) {
|
||||
if (this.minecraftVersion >= PAPER_BRIGADIER_VERSION) {
|
||||
|
|
@ -226,8 +223,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return The backwards command sender mapper
|
||||
*/
|
||||
@Nonnull
|
||||
public final Function<C, CommandSender> getBackwardsCommandSenderMapper() {
|
||||
public final @NonNull Function<@NonNull C, @NonNull CommandSender> getBackwardsCommandSenderMapper() {
|
||||
return this.backwardsCommandSenderMapper;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +244,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @param reason Reason
|
||||
*/
|
||||
public BrigadierFailureException(@Nonnull final BrigadierFailureReason reason) {
|
||||
public BrigadierFailureException(@NonNull final BrigadierFailureReason reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +254,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
* @param reason Reason
|
||||
* @param cause Cause
|
||||
*/
|
||||
public BrigadierFailureException(@Nonnull final BrigadierFailureReason reason, @Nonnull final Throwable cause) {
|
||||
public BrigadierFailureException(@NonNull final BrigadierFailureReason reason, @NonNull final Throwable cause) {
|
||||
super(cause);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
|
@ -268,8 +264,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
*
|
||||
* @return Reason
|
||||
*/
|
||||
@Nonnull
|
||||
public BrigadierFailureReason getReason() {
|
||||
public @NonNull BrigadierFailureReason getReason() {
|
||||
return this.reason;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ package cloud.commandframework.bukkit;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Command sender that proxies {@link org.bukkit.command.CommandSender}
|
||||
|
|
@ -41,7 +40,7 @@ public abstract class BukkitCommandSender {
|
|||
*
|
||||
* @param internalSender Bukkit command sender
|
||||
*/
|
||||
public BukkitCommandSender(@Nonnull final org.bukkit.command.CommandSender internalSender) {
|
||||
public BukkitCommandSender(final org.bukkit.command.@NonNull CommandSender internalSender) {
|
||||
this.internalSender = internalSender;
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +50,7 @@ public abstract class BukkitCommandSender {
|
|||
* @param player Player instance
|
||||
* @return Constructed command sender
|
||||
*/
|
||||
@Nonnull
|
||||
public static BukkitCommandSender player(@Nonnull final Player player) {
|
||||
public static @NonNull BukkitCommandSender player(@NonNull final Player player) {
|
||||
return new BukkitPlayerSender(player);
|
||||
}
|
||||
|
||||
|
|
@ -61,8 +59,7 @@ public abstract class BukkitCommandSender {
|
|||
*
|
||||
* @return Constructed command sender
|
||||
*/
|
||||
@Nonnull
|
||||
public static BukkitCommandSender console() {
|
||||
public static @NonNull BukkitCommandSender console() {
|
||||
return new BukkitConsoleSender();
|
||||
}
|
||||
|
||||
|
|
@ -72,8 +69,7 @@ public abstract class BukkitCommandSender {
|
|||
* @param sender Bukkit command sender
|
||||
* @return Constructed command sender
|
||||
*/
|
||||
@Nonnull
|
||||
public static BukkitCommandSender of(@Nonnull final org.bukkit.command.CommandSender sender) {
|
||||
public static @NonNull BukkitCommandSender of(final org.bukkit.command.@NonNull CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return player((Player) sender);
|
||||
}
|
||||
|
|
@ -102,8 +98,7 @@ public abstract class BukkitCommandSender {
|
|||
*
|
||||
* @return Proxied command sneder
|
||||
*/
|
||||
@Nonnull
|
||||
public org.bukkit.command.CommandSender getInternalSender() {
|
||||
public org.bukkit.command.@NonNull CommandSender getInternalSender() {
|
||||
return this.internalSender;
|
||||
}
|
||||
|
||||
|
|
@ -120,15 +115,14 @@ public abstract class BukkitCommandSender {
|
|||
*
|
||||
* @return Player object
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract Player asPlayer();
|
||||
public abstract @NonNull Player asPlayer();
|
||||
|
||||
/**
|
||||
* Send a message to the command sender
|
||||
*
|
||||
* @param message Message to send
|
||||
*/
|
||||
public void sendMessage(@Nonnull final String message) {
|
||||
public void sendMessage(@NonNull final String message) {
|
||||
this.internalSender.sendMessage(message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,11 @@
|
|||
package cloud.commandframework.bukkit;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
final class BukkitPlayerSender extends BukkitCommandSender {
|
||||
|
||||
BukkitPlayerSender(@Nonnull final Player player) {
|
||||
BukkitPlayerSender(@NonNull final Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
|
|
@ -38,9 +37,8 @@ final class BukkitPlayerSender extends BukkitCommandSender {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Player asPlayer() {
|
||||
public @NonNull Player asPlayer() {
|
||||
return (Player) this.getInternalSender();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue