mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Fix annotation inconsistency and other nonsense
This commit is contained in:
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;
|
||||
|
||||
+3
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+13
-26
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+5
-10
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -11,11 +11,9 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class EconomyContext {
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
private final @NonNull CarbonChatBukkit carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final Economy economy;
|
||||
private final @NonNull Economy economy;
|
||||
|
||||
public EconomyContext(final @NonNull CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+1
-2
@@ -25,8 +25,7 @@ public final class TownyContext implements Listener {
|
||||
@NonNull
|
||||
private static final String KEY = "towny-town";
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public TownyContext(final @NonNull CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+1
-2
@@ -21,8 +21,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class mcMMOContext implements Listener {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private static final String KEY = "mcmmo-party";
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ import java.util.Map;
|
||||
|
||||
public class BukkitChatListener implements Listener {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
private final @NonNull CarbonChatBukkit carbonChat;
|
||||
|
||||
public BukkitChatListener(final @NonNull CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+5
-10
@@ -18,20 +18,15 @@ import java.util.function.Consumer;
|
||||
|
||||
public class BungeeMessageService implements MessageService {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
private final @NonNull CarbonChatBukkit carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final BungeeChannelApi api;
|
||||
private final @NonNull BungeeChannelApi api;
|
||||
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull BiConsumer<@NonNull ChatUser, @NonNull ByteArrayDataInput>> userLoadedListeners = new HashMap<>();
|
||||
private final @NonNull Map<@NonNull String, @NonNull BiConsumer<@NonNull ChatUser, @NonNull ByteArrayDataInput>> userLoadedListeners = new HashMap<>();
|
||||
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull BiConsumer<@NonNull UUID, @NonNull ByteArrayDataInput>> userNotLoadedListeners = new HashMap<>();
|
||||
private final @NonNull Map<@NonNull String, @NonNull BiConsumer<@NonNull UUID, @NonNull ByteArrayDataInput>> userNotLoadedListeners = new HashMap<>();
|
||||
|
||||
@NonNull
|
||||
private final UUID serverUUID = UUID.randomUUID();
|
||||
private final @NonNull UUID serverUUID = UUID.randomUUID();
|
||||
|
||||
public BungeeMessageService(final @NonNull CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
@@ -30,32 +30,23 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitChatUser implements ChatUser, ForwardingAudience {
|
||||
|
||||
@NonNull
|
||||
private final transient CarbonChatBukkit carbonChat;
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull SimpleUserChannelSettings> channelSettings = new HashMap<>();
|
||||
@NonNull
|
||||
private final List<@NonNull UUID> ignoredUsers = new ArrayList<>();
|
||||
@MonotonicNonNull // @NonNull but not initialised in all constructors.
|
||||
private UUID uuid;
|
||||
@Nullable
|
||||
private String selectedChannelKey = null;
|
||||
private final @NonNull transient CarbonChatBukkit carbonChat;
|
||||
private final @NonNull Map<@NonNull String, @NonNull SimpleUserChannelSettings> channelSettings = new HashMap<>();
|
||||
private final @NonNull List<@NonNull UUID> ignoredUsers = new ArrayList<>();
|
||||
private @MonotonicNonNull UUID uuid;
|
||||
private boolean muted = false;
|
||||
private boolean shadowMuted = false;
|
||||
private boolean spyingWhispers = false;
|
||||
private @Nullable String nickname = null;
|
||||
private @Nullable UUID replyTarget = null;
|
||||
|
||||
@Nullable
|
||||
private String nickname = null;
|
||||
|
||||
@Nullable
|
||||
private transient ChatChannel selectedChannel = null;
|
||||
|
||||
@Nullable
|
||||
private transient UUID replyTarget = null;
|
||||
private @Nullable String selectedChannelKey = null;
|
||||
private transient @Nullable ChatChannel selectedChannel = null;
|
||||
|
||||
public BukkitChatUser() {
|
||||
this.carbonChat = (CarbonChatBukkit) Bukkit.getPluginManager().getPlugin("CarbonChat-Bukkit");
|
||||
@@ -84,8 +75,7 @@ public class BukkitChatUser implements ChatUser, ForwardingAudience {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String nickname() {
|
||||
public @Nullable String nickname() {
|
||||
return this.nickname;
|
||||
}
|
||||
|
||||
@@ -152,13 +142,12 @@ public class BukkitChatUser implements ChatUser, ForwardingAudience {
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable String name() {
|
||||
return Bukkit.getOfflinePlayer(this.uuid()).getName();
|
||||
public @NonNull String name() {
|
||||
return Objects.requireNonNull(Bukkit.getOfflinePlayer(this.uuid()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ChatChannel selectedChannel() {
|
||||
public @Nullable ChatChannel selectedChannel() {
|
||||
if (this.selectedChannel != null) {
|
||||
return this.selectedChannel;
|
||||
}
|
||||
@@ -308,13 +297,12 @@ public class BukkitChatUser implements ChatUser, ForwardingAudience {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public UUID replyTarget() {
|
||||
public @Nullable UUID replyTarget() {
|
||||
return this.replyTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replyTarget(@Nullable final UUID target, final boolean fromRemote) {
|
||||
public void replyTarget(final @Nullable UUID target, final boolean fromRemote) {
|
||||
this.replyTarget = target;
|
||||
|
||||
if (!fromRemote) {
|
||||
|
||||
+3
-5
@@ -13,8 +13,7 @@ import java.util.UUID;
|
||||
|
||||
public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
|
||||
@NonNull
|
||||
private final transient CarbonChat carbonChat = CarbonChatProvider.carbonChat();
|
||||
private final @NonNull transient CarbonChat carbonChat = CarbonChatProvider.carbonChat();
|
||||
private boolean spying;
|
||||
private boolean ignored;
|
||||
@Nullable
|
||||
@@ -69,8 +68,7 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TextColor color() {
|
||||
public @Nullable TextColor color() {
|
||||
if (this.color == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -79,7 +77,7 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void color(@Nullable final TextColor color, final boolean fromRemote) {
|
||||
public void color(final @Nullable TextColor color, final boolean fromRemote) {
|
||||
if (color == null) {
|
||||
this.color = null;
|
||||
} else {
|
||||
|
||||
@@ -10,8 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
private final @NonNull CarbonChatBukkit carbonChat;
|
||||
|
||||
public CarbonPlaceholders(final @NonNull CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
@@ -41,8 +40,7 @@ public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String onPlaceholderRequest(final @NonNull Player player, final @NonNull String identifier) {
|
||||
public @Nullable String onPlaceholderRequest(final @NonNull Player player, final @NonNull String identifier) {
|
||||
final String key = identifier.toLowerCase();
|
||||
|
||||
if (key.startsWith("can_use_")) {
|
||||
|
||||
+4
-7
@@ -12,14 +12,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class AdventureManager implements MessageProcessor {
|
||||
|
||||
@NonNull
|
||||
private final AudienceProvider provider;
|
||||
private final @NonNull AudienceProvider provider;
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final FormatType formatType;
|
||||
private final @NonNull FormatType formatType;
|
||||
|
||||
public AdventureManager(final @NonNull AudienceProvider provider, final @NonNull FormatType formatType) {
|
||||
this.provider = provider;
|
||||
@@ -28,7 +25,7 @@ public class AdventureManager implements MessageProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Component processMessage(@Nullable final String input, final @NonNull String @NonNull ... placeholders) {
|
||||
public @NonNull Component processMessage(final @Nullable String input, final @NonNull String @NonNull ... placeholders) {
|
||||
if (input == null || input.trim().isEmpty()) {
|
||||
return Component.empty();
|
||||
}
|
||||
|
||||
+20
-39
@@ -33,13 +33,11 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class CarbonChatChannel implements TextChannel {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final ChannelOptions options;
|
||||
private final @NonNull ChannelOptions options;
|
||||
|
||||
public CarbonChatChannel(final @NonNull CarbonChat carbonChat, @Nullable final ChannelOptions options) {
|
||||
public CarbonChatChannel(final @NonNull CarbonChat carbonChat, final @Nullable ChannelOptions options) {
|
||||
this.carbonChat = carbonChat;
|
||||
this.options = options;
|
||||
}
|
||||
@@ -234,8 +232,7 @@ public class CarbonChatChannel implements TextChannel {
|
||||
return this.parseMessage(user, this.audiences(), message, fromRemote);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String format(final @NonNull ChatUser user) {
|
||||
public @Nullable String format(final @NonNull ChatUser user) {
|
||||
for (final String group : this.groupOverrides()) {
|
||||
if (this.userHasGroup(user, group)) {
|
||||
final String format = this.format(group);
|
||||
@@ -296,14 +293,12 @@ public class CarbonChatChannel implements TextChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String format(final @NonNull Group group) {
|
||||
public @Nullable String format(final @NonNull Group group) {
|
||||
return this.format(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String format(final @NonNull String group) {
|
||||
public @Nullable String format(final @NonNull String group) {
|
||||
return this.options().format(group);
|
||||
}
|
||||
|
||||
@@ -364,8 +359,7 @@ public class CarbonChatChannel implements TextChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TextColor channelColor(final @NonNull ChatUser user) {
|
||||
public @Nullable TextColor channelColor(final @NonNull ChatUser user) {
|
||||
final TextColor userColor = user.channelSettings(this).color();
|
||||
|
||||
if (userColor != null) {
|
||||
@@ -388,8 +382,7 @@ public class CarbonChatChannel implements TextChannel {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String defaultFormatName() {
|
||||
public @Nullable String defaultFormatName() {
|
||||
return this.options().defaultFormatName();
|
||||
}
|
||||
|
||||
@@ -431,62 +424,52 @@ public class CarbonChatChannel implements TextChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String messagePrefix() {
|
||||
public @Nullable String messagePrefix() {
|
||||
return this.options().messagePrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String switchMessage() {
|
||||
public @Nullable String switchMessage() {
|
||||
return this.options().switchMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String switchOtherMessage() {
|
||||
public @Nullable String switchOtherMessage() {
|
||||
return this.options().switchOtherMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String switchFailureMessage() {
|
||||
public @Nullable String switchFailureMessage() {
|
||||
return this.options().switchFailureMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String cannotIgnoreMessage() {
|
||||
public @Nullable String cannotIgnoreMessage() {
|
||||
return this.options().cannotIgnoreMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String toggleOffMessage() {
|
||||
public @Nullable String toggleOffMessage() {
|
||||
return this.options().toggleOffMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String toggleOnMessage() {
|
||||
public @Nullable String toggleOnMessage() {
|
||||
return this.options().toggleOnMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String toggleOtherOnMessage() {
|
||||
public @Nullable String toggleOtherOnMessage() {
|
||||
return this.options().toggleOtherOnMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String toggleOtherOffMessage() {
|
||||
public @Nullable String toggleOtherOffMessage() {
|
||||
return this.options().toggleOtherOffMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String cannotUseMessage() {
|
||||
public @Nullable String cannotUseMessage() {
|
||||
return this.options().cannotUseMessage();
|
||||
}
|
||||
|
||||
@@ -507,14 +490,12 @@ public class CarbonChatChannel implements TextChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public List<String> aliases() {
|
||||
public @Nullable List<String> aliases() {
|
||||
return this.options().aliases();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Context context(final @NonNull String key) {
|
||||
public @Nullable Context context(final @NonNull String key) {
|
||||
return this.options().context(key);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -46,20 +46,20 @@ public class CarbonWhisperChannel implements WhisperChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable TextColor channelColor(@NonNull final ChatUser user) {
|
||||
public @Nullable TextColor channelColor(final @NonNull ChatUser user) {
|
||||
return NamedTextColor.WHITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Map<ChatUser, Component> parseMessage(@NonNull final ChatUser user, @NonNull final String message,
|
||||
public @NonNull Map<ChatUser, Component> parseMessage(final @NonNull ChatUser user, final @NonNull String message,
|
||||
final boolean fromRemote) {
|
||||
return this.parseMessage(user, Collections.singleton(this.audience()), message, fromRemote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Map<ChatUser, Component> parseMessage(@NonNull final ChatUser user,
|
||||
@NonNull final Collection<@NonNull ChatUser> recipients,
|
||||
@NonNull final String message, final boolean fromRemote) {
|
||||
public @NonNull Map<ChatUser, Component> parseMessage(final @NonNull ChatUser user,
|
||||
final @NonNull Collection<@NonNull ChatUser> recipients,
|
||||
final @NonNull String message, final boolean fromRemote) {
|
||||
// TODO: extract to method, this is just the same thing but twice
|
||||
final Map<ChatUser, Component> result = new HashMap<>();
|
||||
|
||||
@@ -167,17 +167,17 @@ public class CarbonWhisperChannel implements WhisperChannel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(@NonNull final ChatUser user) {
|
||||
public boolean canPlayerUse(final @NonNull ChatUser user) {
|
||||
return user.equals(this.sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerSee(@NonNull final ChatUser sender, @NonNull final ChatUser target, final boolean checkSpying) {
|
||||
public boolean canPlayerSee(final @NonNull ChatUser sender, final @NonNull ChatUser target, final boolean checkSpying) {
|
||||
return (checkSpying && target.spyingWhispers()) || (sender.equals(this.sender) && target.equals(this.audience));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerSee(@NonNull final ChatUser target, final boolean checkSpying) {
|
||||
public boolean canPlayerSee(final @NonNull ChatUser target, final boolean checkSpying) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -16,11 +16,9 @@ import java.util.Map;
|
||||
|
||||
public class ChannelManager {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final ChannelRegistry registry;
|
||||
private final @NonNull ChannelRegistry registry;
|
||||
|
||||
@Nullable
|
||||
@MonotonicNonNull
|
||||
@@ -73,7 +71,7 @@ public class ChannelManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable ChatChannel channelOrDefault(@Nullable final String key) {
|
||||
public @Nullable ChatChannel channelOrDefault(final @Nullable String key) {
|
||||
if (key == null) {
|
||||
return this.defaultChannel();
|
||||
}
|
||||
|
||||
+1
-2
@@ -14,8 +14,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ChannelCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ChannelCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class ChannelListCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ChannelListCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -11,8 +11,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ChatReloadCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ChatReloadCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -11,8 +11,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ClearChatCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ClearChatCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class IgnoreCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public IgnoreCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class MeCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public MeCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@ import java.util.Optional;
|
||||
|
||||
public class MessageCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public MessageCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class MuteCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public MuteCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class NicknameCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public NicknameCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ReplyCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ReplyCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class SetColorCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public SetColorCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ShadowMuteCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ShadowMuteCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class SpyChannelCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public SpyChannelCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class SudoChannelCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public SudoChannelCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ToggleCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public ToggleCommand(final @NonNull CommandManager<ChatUser> commandManager) {
|
||||
this.carbonChat = CarbonChatProvider.carbonChat();
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ public final class SoundSerializer implements TypeSerializer<Sound> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Sound deserialize(@NonNull final Type type, @NonNull final ConfigurationNode value) throws ObjectMappingException {
|
||||
public @Nullable Sound deserialize(final @NonNull Type type, final @NonNull ConfigurationNode value) throws ObjectMappingException {
|
||||
if (value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public final class SoundSerializer implements TypeSerializer<Sound> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@NonNull final Type type, @Nullable final Sound obj, @NonNull final ConfigurationNode value) throws ObjectMappingException {
|
||||
public void serialize(final @NonNull Type type, final @Nullable Sound obj, final @NonNull ConfigurationNode value) throws ObjectMappingException {
|
||||
if (obj == null) {
|
||||
value.setValue(null);
|
||||
return;
|
||||
|
||||
+1
-2
@@ -16,8 +16,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class FilterContext {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public FilterContext(final @NonNull CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+2
-4
@@ -15,11 +15,9 @@ import java.util.function.Consumer;
|
||||
|
||||
public class MessageManager {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final MessageService messageService;
|
||||
private final @NonNull MessageService messageService;
|
||||
|
||||
public MessageManager(final @NonNull CarbonChat carbonChat, final @NonNull MessageService messageService) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+6
-12
@@ -22,23 +22,17 @@ import java.util.function.Consumer;
|
||||
|
||||
public class RedisMessageService implements MessageService {
|
||||
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull BiConsumer<@NonNull ChatUser, @NonNull ByteArrayDataInput>> userLoadedListeners = new HashMap<>();
|
||||
private final @NonNull Map<@NonNull String, @NonNull BiConsumer<@NonNull ChatUser, @NonNull ByteArrayDataInput>> userLoadedListeners = new HashMap<>();
|
||||
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull BiConsumer<@NonNull UUID, @NonNull ByteArrayDataInput>> userNotLoadedListeners = new HashMap<>();
|
||||
private final @NonNull Map<@NonNull String, @NonNull BiConsumer<@NonNull UUID, @NonNull ByteArrayDataInput>> userNotLoadedListeners = new HashMap<>();
|
||||
|
||||
@NonNull
|
||||
private final RedisPubSubCommands<@NonNull String, @NonNull String> subscribeSync;
|
||||
private final @NonNull RedisPubSubCommands<@NonNull String, @NonNull String> subscribeSync;
|
||||
|
||||
@NonNull
|
||||
private final RedisPubSubCommands<@NonNull String, @NonNull String> publishSync;
|
||||
private final @NonNull RedisPubSubCommands<@NonNull String, @NonNull String> publishSync;
|
||||
|
||||
@NonNull
|
||||
private final UUID serverUUID = UUID.randomUUID();
|
||||
private final @NonNull UUID serverUUID = UUID.randomUUID();
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public RedisMessageService(final @NonNull CarbonChat carbonChat, final @NonNull RedisCredentials credentials) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
+3
-6
@@ -72,8 +72,7 @@ public class JSONUserService<T extends ChatUser> implements UserService<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T wrap(final @NonNull UUID uuid) {
|
||||
public @Nullable T wrap(final @NonNull UUID uuid) {
|
||||
try {
|
||||
return this.userCache.get(uuid);
|
||||
} catch (final ExecutionException exception) {
|
||||
@@ -83,14 +82,12 @@ public class JSONUserService<T extends ChatUser> implements UserService<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T wrapIfLoaded(final @NonNull UUID uuid) {
|
||||
public @Nullable T wrapIfLoaded(final @NonNull UUID uuid) {
|
||||
return this.userCache.getIfPresent(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T refreshUser(final @NonNull UUID uuid) {
|
||||
public @Nullable T refreshUser(final @NonNull UUID uuid) {
|
||||
this.userCache.invalidate(uuid);
|
||||
|
||||
return this.wrap(uuid);
|
||||
|
||||
+3
-6
@@ -107,8 +107,7 @@ public class MySQLUserService<T extends ChatUser> implements UserService<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T wrap(final @NonNull UUID uuid) {
|
||||
public @Nullable T wrap(final @NonNull UUID uuid) {
|
||||
try {
|
||||
return this.userCache.get(uuid);
|
||||
} catch (final ExecutionException exception) {
|
||||
@@ -118,14 +117,12 @@ public class MySQLUserService<T extends ChatUser> implements UserService<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T wrapIfLoaded(final @NonNull UUID uuid) {
|
||||
public @Nullable T wrapIfLoaded(final @NonNull UUID uuid) {
|
||||
return this.userCache.getIfPresent(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T refreshUser(final @NonNull UUID uuid) {
|
||||
public @Nullable T refreshUser(final @NonNull UUID uuid) {
|
||||
this.userCache.invalidate(uuid);
|
||||
|
||||
return this.wrap(uuid);
|
||||
|
||||
@@ -12,13 +12,11 @@ public final class ColorUtils {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TextColor parseColor(@Nullable final String input) {
|
||||
public @Nullable static TextColor parseColor(final @Nullable String input) {
|
||||
return parseColor(null, input);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TextColor parseColor(@Nullable final ChatUser user, @Nullable String input) {
|
||||
public @Nullable static TextColor parseColor(final @Nullable ChatUser user, @Nullable String input) {
|
||||
if (input == null || input.isEmpty()) {
|
||||
return NamedTextColor.WHITE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user