mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Build Successful
This commit is contained in:
1 parent
7299ff64a5
commit
b33ca93e94
44 files changed
+342
-337
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.kyori.registry.Registry;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChannelRegistry implements Registry<String, ChatChannel> {
|
||||
|
||||
@NonNull
|
||||
private final Map<@NonNull String, @NonNull ChatChannel> registry = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public @NonNull ChatChannel register(@NonNull final String key, @NonNull final ChatChannel value) {
|
||||
this.registry.putIfAbsent(key, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ChatChannel get(@NonNull final String key) {
|
||||
return this.registry.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String key(@NonNull final ChatChannel value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Set<String> keySet() {
|
||||
return this.registry.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Iterator<ChatChannel> iterator() {
|
||||
return this.registry.values().iterator();
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,47 @@ import java.util.regex.Pattern;
|
||||
|
||||
public abstract class ChatChannel implements 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();
|
||||
|
||||
/**
|
||||
* Gets the {@link TextColor} the supplied {@link ChatUser} has set for this channel.
|
||||
* If none is set, returns this channel's set color with the "color" config option.
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* If this channel can be ignored, such as through the /toggle command.
|
||||
* @return IF this channel can be ignored / toggled.
|
||||
*/
|
||||
public abstract 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();
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -15,6 +15,10 @@ public interface ChatUser extends Audience {
|
||||
@Nullable
|
||||
String nickname();
|
||||
|
||||
boolean permissible();
|
||||
|
||||
boolean hasPermission(@NonNull String permission);
|
||||
|
||||
default void nickname(@NonNull final String nickname) {
|
||||
this.nickname(nickname, false);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import java.util.UUID;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
@Nullable
|
||||
ChatUser wrap(String name);
|
||||
|
||||
@Nullable
|
||||
ChatUser wrap(UUID uuid);
|
||||
|
||||
|
||||
Reference in new issue
Block a user