Begin color preference changes

This commit is contained in:
Draycia committed 2020-11-06 02:19:50 -08:00
1 parent af705e7812
commit 77e74d05a3
8 files changed
+155 -96

No files matched your search

@@ -1,5 +1,6 @@
package net.draycia.carbon.api.config;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.draycia.carbon.api.CarbonChatProvider;
import net.draycia.carbon.api.Context;
@@ -123,6 +124,15 @@ public final class ChannelOptions {
@Setting
@Comment("The message that's sent when you attempt to ignore a channel but are unable to do so")
private String cannotIgnoreMessage;
@Setting
@Comment("The order in which colors are chosen for the <color> tag.\n" +
"Options:\n" +
" PLAYER: The color the player has set with /setcolor\n" +
" CUSTOM: The color the player has set with /setchannelcolor\n" +
" CHANNEL: The color the channel has set in its settings")
private List<@NonNull ColorPriority> colorPriorities = ImmutableList.of(
ColorPriority.PLAYER, ColorPriority.CUSTOM, ColorPriority.CHANNEL);
private @NonNull SharedChannelOptions defaultOptions() {
return CarbonChatProvider.carbonChat().channelSettings().defaultChannelOptions();
@@ -406,6 +416,14 @@ public final class ChannelOptions {
return this.shouldCancelChatEvent;
}
public List<ColorPriority> colorPriorities() {
if (this.colorPriorities == null) {
return this.defaultOptions().colorPriorities();
}
return this.colorPriorities;
}
public @Nullable List<String> aliases() {
return this.aliases;
}
@@ -0,0 +1,7 @@
package net.draycia.carbon.api.config;
public enum ColorPriority {
PLAYER,
CUSTOM,
CHANNEL
}
@@ -36,6 +36,7 @@ public final class SharedChannelOptions {
@Setting private @NonNull String toggleOtherOffMessage = "<gray><player> <reset><gray>can no longer see <color><channel> <gray>chat!";
@Setting private @NonNull String cannotUseMessage = "You cannot use that channel!";
@Setting private @NonNull String cannotIgnoreMessage = "<red>You cannot ignore that channel!";
@Setting private @NonNull List<@NonNull ColorPriority> colorPriorities = new ArrayList<>();
public @NonNull String color() {
return this.color;
@@ -117,4 +118,7 @@ public final class SharedChannelOptions {
return this.shouldCancelChatEvent;
}
public @NonNull List<@NonNull ColorPriority> colorPriorities() {
return this.colorPriorities;
}
}
@@ -1,6 +1,7 @@
package net.draycia.carbon.api.users;
import net.draycia.carbon.api.channels.ChatChannel;
import net.kyori.adventure.text.format.TextColor;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -29,6 +30,10 @@ public interface PlayerUser extends CarbonUser {
@NonNull String name();
@Nullable TextColor customChatColor();
void customChatColor(@Nullable TextColor customChatColor);
@NonNull String parsePlaceholders(@NonNull String input);
@NonNull UserChannelSettings channelSettings(@NonNull ChatChannel channel);
@@ -107,15 +112,15 @@ public interface PlayerUser extends CarbonUser {
@NonNull Iterable<UUID> ignoredUsers();
boolean hasGroup(final @NonNull String group);
boolean hasGroup(@NonNull String group);
boolean hasGroup(final @NonNull Group group);
boolean hasGroup(@NonNull Group group);
@NonNull Collection<@NonNull Group> groups();
@Nullable Group primaryGroup();
void sendMessage(final @NonNull PlayerUser sender, @NonNull String message);
void sendMessage(@NonNull PlayerUser sender, @NonNull String message);
@Nullable ChatChannel selectedChannel();