mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +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
+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();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user