Make ChatChannel an interface

This commit is contained in:
Draycia committed 2020-09-25 01:43:17 -07:00
1 parent b33ca93e94
commit 508ad88e26
2 files changed
+36 -62

No files matched your search

@@ -12,14 +12,13 @@ import java.util.Collection;
import java.util.List;
import java.util.regex.Pattern;
public abstract class ChatChannel implements ForwardingAudience {
public interface ChatChannel extends ForwardingAudience {
/**
* Gets a list of {@link ChatUser}s to send channel messages to.
* @return All {@link ChatUser}s that can see messages in this channel.
*/
@NonNull
public abstract List<ChatUser> audiences();
@NonNull List<ChatUser> audiences();
/**
* Gets the {@link TextColor} the supplied {@link ChatUser} has set for this channel.
@@ -27,111 +26,86 @@ public abstract class ChatChannel implements ForwardingAudience {
* @param user The user that may have a color set.
* @return The color the user may have set, otherwise the channel's color.
*/
@Nullable
public abstract TextColor channelColor(@NonNull ChatUser user);
@Nullable TextColor channelColor(@NonNull ChatUser user);
/**
* Gets the string format for the specified group.
* @param group The group.
* @return The string format for the specified group.
*/
@Nullable
public abstract String format(@NonNull String group);
@Nullable String format(@NonNull String group);
/**
* If this channel is the channel players get when they join for the first time.
* Also the fallback channel in case the code is unable to find any given channel.
* @return If this is the default channel.
*/
public abstract boolean isDefault();
boolean isDefault();
/**
* If this channel can be ignored, such as through the /toggle command.
* @return IF this channel can be ignored / toggled.
*/
public abstract boolean ignorable();
boolean ignorable();
/**
* If this channel syncs between servers, typically through the messaging service.
* @return If this channel syncs between servers, typically through the messaging service.
*/
public abstract boolean crossServer();
boolean crossServer();
@NonNull
public abstract String name();
@NonNull String name();
@NonNull
public abstract String key();
@NonNull String key();
@Nullable
public abstract String messagePrefix();
@Nullable String messagePrefix();
@Nullable
public abstract String aliases();
@Nullable String aliases();
@Nullable
public abstract String switchMessage();
@Nullable String switchMessage();
@Nullable
public abstract String switchOtherMessage();
@Nullable String switchOtherMessage();
@Nullable
public abstract String switchFailureMessage();
@Nullable String switchFailureMessage();
@Nullable
public abstract String cannotIgnoreMessage();
@Nullable String cannotIgnoreMessage();
@Nullable
public abstract String toggleOffMessage();
@Nullable String toggleOffMessage();
@Nullable
public abstract String toggleOnMessage();
@Nullable String toggleOnMessage();
@Nullable
public abstract String toggleOtherOnMessage();
@Nullable String toggleOtherOnMessage();
@Nullable
public abstract String toggleOtherOffMessage();
@Nullable String toggleOtherOffMessage();
@Nullable
public abstract String cannotUseMessage();
@Nullable String cannotUseMessage();
public abstract boolean primaryGroupOnly();
boolean primaryGroupOnly();
public abstract boolean honorsRecipientList();
boolean honorsRecipientList();
public abstract boolean permissionGroupMatching();
boolean permissionGroupMatching();
public abstract boolean shouldCancelChatEvent();
boolean shouldCancelChatEvent();
public abstract boolean testContext(@NonNull ChatUser sender, @NonNull ChatUser target);
boolean testContext(@NonNull ChatUser sender, @NonNull ChatUser target);
@NonNull
public abstract List<@NonNull Pattern> itemLinkPatterns();
@NonNull List<@NonNull Pattern> itemLinkPatterns();
@Nullable
public abstract Context context(@NonNull String key);
@Nullable Context context(@NonNull String key);
@NonNull
public abstract List<@NonNull String> groupOverrides();
@NonNull List<@NonNull String> groupOverrides();
public abstract boolean canPlayerUse(@NonNull ChatUser user);
boolean canPlayerUse(@NonNull ChatUser user);
public abstract boolean canPlayerSee(@NonNull ChatUser sender, @NonNull ChatUser target, boolean checkSpying);
boolean canPlayerSee(@NonNull ChatUser sender, @NonNull ChatUser target, boolean checkSpying);
public abstract boolean canPlayerSee(@NonNull ChatUser target, boolean checkSpying);
boolean canPlayerSee(@NonNull ChatUser target, boolean checkSpying);
@NonNull
public abstract Component sendMessage(@NonNull ChatUser user, @NonNull String message, boolean fromBungee);
@NonNull Component sendMessage(@NonNull ChatUser user, @NonNull String message, boolean fromBungee);
@NonNull
public abstract Component sendMessage(@NonNull ChatUser user, @NonNull Collection<@NonNull ChatUser> recipients, @NonNull String message, boolean fromBungee);
@NonNull Component sendMessage(@NonNull ChatUser user, @NonNull Collection<@NonNull ChatUser> recipients, @NonNull String message, boolean fromBungee);
public abstract void sendComponent(@NonNull ChatUser user, @NonNull Component component);
@Nullable
public String processPlaceholders(@NonNull final ChatUser user, @Nullable final String input) {
return input;
}
void sendComponent(@NonNull ChatUser user, @NonNull Component component);
}