Fix annotation inconsistency and other nonsense

This commit is contained in:
Draycia committed 2020-10-02 23:28:11 -07:00
1 parent 3f6d47be1c
commit 8a1b574d62
48 files changed
+182 -326

No files matched your search

@@ -7,7 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface MessageProcessor {
@NonNull Component processMessage(@Nullable final String input, final @NonNull String @NonNull ... placeholders);
@NonNull Component processMessage(final @Nullable String input, final @NonNull String @NonNull ... placeholders);
@NonNull AudienceProvider audiences();
@@ -11,8 +11,7 @@ import java.util.Set;
public class ChannelRegistry implements Registry<String, ChatChannel> {
@NonNull
private final Map<@NonNull String, @NonNull ChatChannel> registry = new HashMap<>();
private final @NonNull Map<@NonNull String, @NonNull ChatChannel> registry = new HashMap<>();
@Nullable
private ChatChannel defaultChannel = null;
@@ -1,5 +1,6 @@
package net.draycia.carbon.api.commands.settings;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.configurate.objectmapping.Setting;
import org.spongepowered.configurate.serialize.ConfigSerializable;
@@ -13,10 +14,10 @@ public class CommandSettings {
private boolean enabled;
@Setting
private @NonNull String name;
private @MonotonicNonNull String name;
@Setting
private @NonNull Set<@NonNull String> aliases;
private @MonotonicNonNull Set<@NonNull String> aliases;
public @NonNull Set<@NonNull String> aliases() {
return this.aliases;
@@ -116,8 +116,7 @@ public class ChannelOptions {
return this.key;
}
@Nullable
public String color() {
public @Nullable String color() {
if (this.color == null) {
return this.defaultOptions().color();
}
@@ -125,8 +124,7 @@ public class ChannelOptions {
return this.color;
}
@Nullable
public Context context(final @NonNull String key) {
public @Nullable Context context(final @NonNull String key) {
final Context localContext;
if (this.contexts != null) {
@@ -146,8 +144,7 @@ public class ChannelOptions {
return localContext;
}
@Nullable
public Map<String, Context> contexts() {
public @Nullable Map<String, Context> contexts() {
if (this.contexts == null) {
return this.defaultOptions().contexts();
}
@@ -155,8 +152,7 @@ public class ChannelOptions {
return this.contexts;
}
@Nullable
public Map<String, Context> contextsAndDefault() {
public @Nullable Map<String, Context> contextsAndDefault() {
if (this.contexts == null) {
return this.defaultOptions().contexts();
}
@@ -171,8 +167,7 @@ public class ChannelOptions {
return contexts;
}
@Nullable
public String format(final @NonNull String key) {
public @Nullable String format(final @NonNull String key) {
final String localFormat;
if (this.formats() != null) {
@@ -192,8 +187,7 @@ public class ChannelOptions {
return localFormat;
}
@Nullable
public Map<String, String> formats() {
public @Nullable Map<String, String> formats() {
if (this.formats == null) {
return this.defaultOptions().formats();
}
@@ -201,8 +195,7 @@ public class ChannelOptions {
return this.formats;
}
@Nullable
public Map<String, String> formatsAndDefault() {
public @Nullable Map<String, String> formatsAndDefault() {
if (this.formats == null) {
return this.defaultOptions().formats();
}
@@ -217,8 +210,7 @@ public class ChannelOptions {
return formats;
}
@Nullable
public String defaultFormatName() {
public @Nullable String defaultFormatName() {
if (this.defaultFormatName == null || this.defaultFormatName.isEmpty()) {
return this.defaultOptions().defaultFormatName();
}
@@ -280,13 +272,11 @@ public class ChannelOptions {
return this.name;
}
@Nullable
public String messagePrefix() {
public @Nullable String messagePrefix() {
return this.messagePrefix;
}
@Nullable
public String switchMessage() {
public @Nullable String switchMessage() {
if (this.switchMessage == null) {
return this.defaultOptions().switchMessage();
}
@@ -294,8 +284,7 @@ public class ChannelOptions {
return this.switchMessage;
}
@Nullable
public String switchOtherMessage() {
public @Nullable String switchOtherMessage() {
if (this.switchOtherMessage == null) {
return this.defaultOptions().switchOtherMessage();
}
@@ -303,8 +292,7 @@ public class ChannelOptions {
return this.switchOtherMessage;
}
@Nullable
public String switchFailureMessage() {
public @Nullable String switchFailureMessage() {
if (this.switchFailureMessage == null) {
return this.defaultOptions().switchFailureMessage();
}
@@ -312,8 +300,7 @@ public class ChannelOptions {
return this.switchFailureMessage;
}
@Nullable
public String cannotIgnoreMessage() {
public @Nullable String cannotIgnoreMessage() {
if (this.cannotIgnoreMessage == null) {
return this.defaultOptions().cannotIgnoreMessage();
}
@@ -321,8 +308,7 @@ public class ChannelOptions {
return this.cannotIgnoreMessage;
}
@Nullable
public String toggleOffMessage() {
public @Nullable String toggleOffMessage() {
if (this.toggleOffMessage == null) {
return this.defaultOptions().toggleOffMessage();
}
@@ -330,8 +316,7 @@ public class ChannelOptions {
return this.toggleOffMessage;
}
@Nullable
public String toggleOnMessage() {
public @Nullable String toggleOnMessage() {
if (this.toggleOnMessage == null) {
return this.defaultOptions().toggleOnMessage();
}
@@ -339,8 +324,7 @@ public class ChannelOptions {
return this.toggleOnMessage;
}
@Nullable
public String toggleOtherOnMessage() {
public @Nullable String toggleOtherOnMessage() {
if (this.toggleOtherOnMessage == null) {
return this.defaultOptions().toggleOtherOnMessage();
}
@@ -348,8 +332,7 @@ public class ChannelOptions {
return this.toggleOtherOnMessage;
}
@Nullable
public String toggleOtherOffMessage() {
public @Nullable String toggleOtherOffMessage() {
if (this.toggleOtherOffMessage == null) {
return this.defaultOptions().toggleOtherOffMessage();
}
@@ -357,8 +340,7 @@ public class ChannelOptions {
return this.toggleOtherOffMessage;
}
@Nullable
public String cannotUseMessage() {
public @Nullable String cannotUseMessage() {
if (this.cannotUseMessage == null) {
return this.defaultOptions().cannotUseMessage();
}
@@ -382,8 +364,7 @@ public class ChannelOptions {
return this.shouldCancelChatEvent;
}
@Nullable
public List<String> aliases() {
public @Nullable List<String> aliases() {
return this.aliases;
}
@@ -35,23 +35,19 @@ public class SharedChannelOptions {
@Setting private String cannotUseMessage = "You cannot use that channel!";
@Setting private String cannotIgnoreMessage = "<red>You cannot ignore that channel!";
@Nullable
public String color() {
public @Nullable String color() {
return this.color;
}
@Nullable
public Map<String, Context> contexts() {
public @Nullable Map<String, Context> contexts() {
return this.contexts;
}
@Nullable
public Map<String, String> formats() {
public @Nullable Map<String, String> formats() {
return this.formats;
}
@Nullable
public String defaultFormatName() {
public @Nullable String defaultFormatName() {
return this.defaultFormatName;
}
@@ -76,48 +72,39 @@ public class SharedChannelOptions {
return this.groupOverrides;
}
@Nullable
public String switchMessage() {
public @Nullable String switchMessage() {
return this.switchMessage;
}
@Nullable
public String switchOtherMessage() {
public @Nullable String switchOtherMessage() {
return this.switchOtherMessage;
}
@Nullable
public String switchFailureMessage() {
public @Nullable String switchFailureMessage() {
return this.switchFailureMessage;
}
@Nullable
public String cannotIgnoreMessage() {
public @Nullable String cannotIgnoreMessage() {
return this.cannotIgnoreMessage;
}
@Nullable
public String toggleOffMessage() {
public @Nullable String toggleOffMessage() {
return this.toggleOffMessage;
}
@Nullable
public String toggleOnMessage() {
public @Nullable String toggleOnMessage() {
return this.toggleOnMessage;
}
@Nullable
public String toggleOtherOnMessage() {
public @Nullable String toggleOtherOnMessage() {
return this.toggleOtherOnMessage;
}
@Nullable
public String toggleOtherOffMessage() {
public @Nullable String toggleOtherOffMessage() {
return this.toggleOtherOffMessage;
}
@Nullable
public String cannotUseMessage() {
public @Nullable String cannotUseMessage() {
return this.cannotUseMessage;
}
@@ -58,63 +58,51 @@ public class WhisperOptions {
return this.pings;
}
@Nullable
public String consoleFormat() {
public @Nullable String consoleFormat() {
return this.consoleFormat;
}
@Nullable
public String senderFormat() {
public @Nullable String senderFormat() {
return this.senderFormat;
}
@Nullable
public String receiverFormat() {
public @Nullable String receiverFormat() {
return this.receiverFormat;
}
@Nullable
public String switchMessage() {
public @Nullable String switchMessage() {
return this.switchMessage;
}
@Nullable
public String switchOtherMessage() {
public @Nullable String switchOtherMessage() {
return this.switchOtherMessage;
}
@Nullable
public String switchFailureMessage() {
public @Nullable String switchFailureMessage() {
return this.switchFailureMessage;
}
@Nullable
public String cannotIgnoreMessage() {
public @Nullable String cannotIgnoreMessage() {
return this.cannotIgnoreMessage;
}
@Nullable
public String toggleOffMessage() {
public @Nullable String toggleOffMessage() {
return this.toggleOffMessage;
}
@Nullable
public String toggleOnMessage() {
public @Nullable String toggleOnMessage() {
return this.toggleOnMessage;
}
@Nullable
public String toggleOtherOnMessage() {
public @Nullable String toggleOtherOnMessage() {
return this.toggleOtherOnMessage;
}
@Nullable
public String toggleOtherOffMessage() {
public @Nullable String toggleOtherOffMessage() {
return this.toggleOtherOffMessage;
}
@Nullable
public String cannotUseMessage() {
public @Nullable String cannotUseMessage() {
return this.cannotUseMessage;
}
@@ -9,10 +9,8 @@ import java.util.List;
public class ChannelRegisterEvent implements CarbonEvent {
@NonNull
private final List<@NonNull ChatChannel> registeredChannels;
@NonNull
private final Registry<String, ChatChannel> registry;
private final @NonNull List<@NonNull ChatChannel> registeredChannels;
private final @NonNull Registry<String, ChatChannel> registry;
public ChannelRegisterEvent(final @NonNull List<@NonNull ChatChannel> registeredChannels, final @NonNull Registry<String, ChatChannel> registry) {
this.registeredChannels = registeredChannels;
@@ -9,15 +9,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ChannelSwitchEvent implements CarbonEvent, Cancellable {
@NonNull
private final ChatChannel channel;
@NonNull
private final ChatUser user;
private final @NonNull ChatChannel channel;
private final @NonNull ChatUser user;
@Nullable
private String failureMessage;
private boolean cancelled = false;
public ChannelSwitchEvent(final @NonNull ChatChannel channel, final @NonNull ChatUser user, @Nullable final String failureMessage) {
public ChannelSwitchEvent(final @NonNull ChatChannel channel, final @NonNull ChatUser user, final @Nullable String failureMessage) {
this.channel = channel;
this.user = user;
this.failureMessage = failureMessage;
@@ -33,12 +31,11 @@ public class ChannelSwitchEvent implements CarbonEvent, Cancellable {
return this.channel;
}
@Nullable
public String failureMessage() {
public @Nullable String failureMessage() {
return this.failureMessage;
}
public void failureMessage(@Nullable final String failureMessage) {
public void failureMessage(final @Nullable String failureMessage) {
this.failureMessage = failureMessage;
}
@@ -11,18 +11,16 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ChatComponentEvent implements CarbonEvent, Cancellable {
private boolean isCancelled = false;
@NonNull
private final ChatUser sender;
private final @NonNull ChatUser sender;
@Nullable
private final ChatUser target;
@NonNull
private ChatChannel chatChannel;
@NonNull
private TextComponent component;
@NonNull
private final String originalMessage;
private final @NonNull String originalMessage;
public ChatComponentEvent(final @NonNull ChatUser sender, @Nullable final ChatUser target,
public ChatComponentEvent(final @NonNull ChatUser sender, final @Nullable ChatUser target,
final @NonNull ChatChannel chatChannel, final @NonNull TextComponent component,
final @NonNull String originalMessage) {
@@ -48,8 +46,7 @@ public class ChatComponentEvent implements CarbonEvent, Cancellable {
return this.sender;
}
@Nullable
public ChatUser target() {
public @Nullable ChatUser target() {
return this.target;
}
@@ -10,8 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ChatFormatEvent implements CarbonEvent, Cancellable {
private boolean isCancelled = false;
@NonNull
private final ChatUser sender;
private final @NonNull ChatUser sender;
@Nullable
private final ChatUser target;
@NonNull
@@ -21,8 +20,8 @@ public class ChatFormatEvent implements CarbonEvent, Cancellable {
@NonNull
private String message;
public ChatFormatEvent(final @NonNull ChatUser sender, @Nullable final ChatUser target,
final @NonNull ChatChannel chatChannel, @Nullable final String format,
public ChatFormatEvent(final @NonNull ChatUser sender, final @Nullable ChatUser target,
final @NonNull ChatChannel chatChannel, final @Nullable String format,
final @NonNull String message) {
this.sender = sender;
@@ -48,8 +47,7 @@ public class ChatFormatEvent implements CarbonEvent, Cancellable {
return this.sender;
}
@Nullable
public ChatUser target() {
public @Nullable ChatUser target() {
return this.target;
}
@@ -62,12 +60,11 @@ public class ChatFormatEvent implements CarbonEvent, Cancellable {
this.chatChannel = chatChannel;
}
@Nullable
public String format() {
public @Nullable String format() {
return this.format;
}
public void format(@Nullable final String format) {
public void format(final @Nullable String format) {
this.format = format;
}
@@ -10,8 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class PreChatFormatEvent implements CarbonEvent, Cancellable {
private boolean isCancelled = false;
@NonNull
private final ChatUser user;
private final @NonNull ChatUser user;
@NonNull
private ChatChannel chatChannel;
@Nullable
@@ -20,7 +19,7 @@ public class PreChatFormatEvent implements CarbonEvent, Cancellable {
private String message;
public PreChatFormatEvent(final @NonNull ChatUser user, final @NonNull ChatChannel chatChannel,
@Nullable final String format, final @NonNull String message) {
final @Nullable String format, final @NonNull String message) {
this.user = user;
this.chatChannel = chatChannel;
@@ -52,12 +51,11 @@ public class PreChatFormatEvent implements CarbonEvent, Cancellable {
this.chatChannel = chatChannel;
}
@Nullable
public String format() {
public @Nullable String format() {
return this.format;
}
public void format(@Nullable final String format) {
public void format(final @Nullable String format) {
this.format = format;
}
@@ -8,16 +8,11 @@ import org.checkerframework.checker.nullness.qual.NonNull;
public class PrivateMessageEvent implements CarbonEvent, Cancellable {
@NonNull
private final ChatUser sender;
@NonNull
private final ChatUser target;
@NonNull
private final Component senderComponent;
@NonNull
private final Component targetComponent;
@NonNull
private final String message;
private final @NonNull ChatUser sender;
private final @NonNull ChatUser target;
private final @NonNull Component senderComponent;
private final @NonNull Component targetComponent;
private final @NonNull String message;
private boolean cancelled = false;
public PrivateMessageEvent(final @NonNull ChatUser sender, final @NonNull ChatUser target,
@@ -23,7 +23,7 @@ public interface ChatUser extends Audience {
@Nullable String nickname();
default void nickname(@Nullable final String nickname) {
default void nickname(final @Nullable String nickname) {
this.nickname(nickname, false);
}
@@ -75,17 +75,17 @@ public interface ChatUser extends Audience {
@Nullable UUID replyTarget();
default void replyTarget(@Nullable final UUID target) {
default void replyTarget(final @Nullable UUID target) {
this.replyTarget(target, false);
}
default void replyTarget(@Nullable final ChatUser user) {
default void replyTarget(final @Nullable ChatUser user) {
this.replyTarget(user.uuid(), false);
}
void replyTarget(@Nullable UUID target, boolean fromRemote);
default void replyTarget(@Nullable final ChatUser user, final boolean fromRemote) {
default void replyTarget(final @Nullable ChatUser user, final boolean fromRemote) {
this.replyTarget(user.uuid(), fromRemote);
}
@@ -113,13 +113,13 @@ public interface ChatUser extends Audience {
@NonNull Iterable<UUID> ignoredUsers();
boolean hasGroup(@NonNull final String group);
boolean hasGroup(final @NonNull String group);
boolean hasGroup(@NonNull final Group group);
boolean hasGroup(final @NonNull Group group);
@NonNull Collection<@NonNull Group> groups();
@NonNull Group primaryGroup();
@Nullable Group primaryGroup();
void sendMessage(final @NonNull ChatUser sender, @NonNull String message);
@@ -24,7 +24,7 @@ public interface UserChannelSettings {
@Nullable
TextColor color();
default void color(@Nullable final TextColor color) {
default void color(final @Nullable TextColor color) {
this.color(color, false);
}