mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Refactor ChatUser
This commit is contained in:
1 parent
f9515f98fb
commit
941d7ee096
56 files changed
+455
-354
No files matched your search
@@ -8,7 +8,8 @@ import net.draycia.carbon.api.config.CarbonSettings;
|
||||
import net.draycia.carbon.api.config.ChannelSettings;
|
||||
import net.draycia.carbon.api.config.ModerationSettings;
|
||||
import net.draycia.carbon.api.messaging.MessageService;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.draycia.carbon.api.users.UserService;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
@@ -33,7 +34,7 @@ public interface CarbonChat {
|
||||
|
||||
@NonNull Path dataFolder();
|
||||
|
||||
@NonNull <T extends ChatUser> UserService<T> userService();
|
||||
@NonNull <T extends PlayerUser> UserService<T> userService();
|
||||
|
||||
@NonNull MessageProcessor messageProcessor();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
@@ -15,29 +15,29 @@ import java.util.regex.Pattern;
|
||||
public interface ChatChannel extends Audience {
|
||||
|
||||
/**
|
||||
* Gets the {@link TextColor} the supplied {@link ChatUser} has set for this channel.
|
||||
* Gets the {@link TextColor} the supplied {@link CarbonUser} 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 TextColor channelColor(@NonNull ChatUser user);
|
||||
@Nullable TextColor channelColor(@NonNull CarbonUser user);
|
||||
|
||||
@NonNull
|
||||
Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull String message, boolean fromRemote);
|
||||
Map<CarbonUser, Component> parseMessage(@NonNull CarbonUser user, @NonNull String message, boolean fromRemote);
|
||||
|
||||
@NonNull
|
||||
Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull Collection<@NonNull ChatUser> recipients,
|
||||
@NonNull String message, boolean fromRemote);
|
||||
Map<CarbonUser, Component> parseMessage(@NonNull CarbonUser user, @NonNull Collection<@NonNull CarbonUser> recipients,
|
||||
@NonNull String message, boolean fromRemote);
|
||||
|
||||
boolean canPlayerUse(@NonNull ChatUser user);
|
||||
boolean canPlayerUse(@NonNull CarbonUser user);
|
||||
|
||||
boolean canPlayerSee(@NonNull ChatUser sender, @NonNull ChatUser target, boolean checkSpying);
|
||||
boolean canPlayerSee(@NonNull CarbonUser sender, @NonNull CarbonUser target, boolean checkSpying);
|
||||
|
||||
boolean canPlayerSee(@NonNull ChatUser target, boolean checkSpying);
|
||||
boolean canPlayerSee(@NonNull CarbonUser target, boolean checkSpying);
|
||||
|
||||
void sendComponents(@NonNull final Map<ChatUser, Component> components);
|
||||
void sendComponents(@NonNull final Map<CarbonUser, Component> components);
|
||||
|
||||
void sendComponentsAndLog(@NonNull final Map<ChatUser, Component> components);
|
||||
void sendComponentsAndLog(@NonNull final Map<CarbonUser, Component> components);
|
||||
|
||||
@NonNull String name();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@@ -8,9 +8,9 @@ import java.util.Collection;
|
||||
|
||||
public interface GroupChannel extends ChatChannel, ForwardingAudience {
|
||||
|
||||
@NonNull ChatUser owner();
|
||||
@NonNull CarbonUser owner();
|
||||
|
||||
@Override
|
||||
@NonNull Collection<@NonNull ChatUser> audiences();
|
||||
@NonNull Collection<@NonNull CarbonUser> audiences();
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public interface TextChannel extends ChatChannel, ForwardingAudience {
|
||||
|
||||
@Override
|
||||
@NonNull List<@NonNull ChatUser> audiences();
|
||||
@NonNull List<@NonNull CarbonUser> audiences();
|
||||
|
||||
/**
|
||||
* Gets the string format for the specified group.
|
||||
@@ -53,12 +53,12 @@ public interface TextChannel extends ChatChannel, ForwardingAudience {
|
||||
|
||||
boolean permissionGroupMatching();
|
||||
|
||||
boolean testContext(@NonNull ChatUser sender, @NonNull ChatUser target);
|
||||
boolean testContext(@NonNull CarbonUser sender, @NonNull CarbonUser target);
|
||||
|
||||
@Nullable Context context(@NonNull String key);
|
||||
|
||||
@NonNull List<@NonNull String> groupOverrides();
|
||||
|
||||
void sendComponent(@NonNull ChatUser user, @NonNull Component component);
|
||||
void sendComponent(@NonNull CarbonUser user, @NonNull Component component);
|
||||
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public interface WhisperChannel extends ChatChannel, ForwardingAudience.Single {
|
||||
|
||||
@NonNull ChatUser sender();
|
||||
@NonNull CarbonUser sender();
|
||||
|
||||
/**
|
||||
* The recipient for this channel, where messages are sent to.
|
||||
* @return The channel recipient.
|
||||
*/
|
||||
@Override
|
||||
@NonNull ChatUser audience();
|
||||
@NonNull CarbonUser audience();
|
||||
|
||||
@Override
|
||||
default @NonNull String name() {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -10,17 +11,17 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
public class ChannelSwitchEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private @NonNull final ChatChannel channel;
|
||||
private @NonNull final ChatUser user;
|
||||
private @NonNull final PlayerUser user;
|
||||
private @NonNull String failureMessage;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public ChannelSwitchEvent(@NonNull final ChatChannel channel, @NonNull final ChatUser user, @Nullable final String failureMessage) {
|
||||
public ChannelSwitchEvent(@NonNull final ChatChannel channel, @NonNull final PlayerUser user, @Nullable final String failureMessage) {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
this.failureMessage = failureMessage;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser user() {
|
||||
public @NonNull PlayerUser user() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.event.Cancellable;
|
||||
@@ -11,13 +11,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
public class ChatComponentEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private boolean isCancelled = false;
|
||||
private @NonNull final ChatUser sender;
|
||||
private @NonNull final ChatUser target;
|
||||
private @NonNull final CarbonUser sender;
|
||||
private @NonNull final CarbonUser target;
|
||||
private @NonNull ChatChannel chatChannel;
|
||||
private @NonNull TextComponent component;
|
||||
private @NonNull final String originalMessage;
|
||||
|
||||
public ChatComponentEvent(@NonNull final ChatUser sender, @Nullable final ChatUser target,
|
||||
public ChatComponentEvent(@NonNull final CarbonUser sender, @Nullable final CarbonUser target,
|
||||
@NonNull final ChatChannel chatChannel, @NonNull final TextComponent component,
|
||||
@NonNull final String originalMessage) {
|
||||
|
||||
@@ -38,11 +38,11 @@ public class ChatComponentEvent implements CarbonEvent, Cancellable {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser sender() {
|
||||
public @NonNull CarbonUser sender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public @Nullable ChatUser target() {
|
||||
public @Nullable CarbonUser target() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -10,13 +10,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
public class ChatFormatEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private boolean isCancelled = false;
|
||||
private @NonNull final ChatUser sender;
|
||||
private @NonNull final ChatUser target;
|
||||
private @NonNull final CarbonUser sender;
|
||||
private @NonNull final CarbonUser target;
|
||||
private @NonNull ChatChannel chatChannel;
|
||||
private @NonNull String format;
|
||||
private @NonNull String message;
|
||||
|
||||
public ChatFormatEvent(@NonNull final ChatUser sender, @Nullable final ChatUser target,
|
||||
public ChatFormatEvent(@NonNull final CarbonUser sender, @Nullable final CarbonUser target,
|
||||
@NonNull final ChatChannel chatChannel, @Nullable final String format,
|
||||
@NonNull final String message) {
|
||||
|
||||
@@ -38,11 +38,11 @@ public class ChatFormatEvent implements CarbonEvent, Cancellable {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser sender() {
|
||||
public @NonNull CarbonUser sender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public @Nullable ChatUser target() {
|
||||
public @Nullable CarbonUser target() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class MessageContextEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private @NonNull final TextChannel channel;
|
||||
private @NonNull final ChatUser user;
|
||||
private @NonNull final PlayerUser user;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public MessageContextEvent(@NonNull final TextChannel channel, @NonNull final ChatUser user) {
|
||||
public MessageContextEvent(@NonNull final TextChannel channel, @NonNull final PlayerUser user) {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class MessageContextEvent implements CarbonEvent, Cancellable {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser user() {
|
||||
public @NonNull PlayerUser user() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class PreChatFormatEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private boolean isCancelled = false;
|
||||
private @NonNull final ChatUser user;
|
||||
private @NonNull final PlayerUser user;
|
||||
private @NonNull ChatChannel chatChannel;
|
||||
private @NonNull String format;
|
||||
private @NonNull String message;
|
||||
|
||||
public PreChatFormatEvent(@NonNull final ChatUser user, @NonNull final ChatChannel chatChannel,
|
||||
public PreChatFormatEvent(@NonNull final PlayerUser user, @NonNull final ChatChannel chatChannel,
|
||||
@NonNull final String format, @NonNull final String message) {
|
||||
|
||||
this.user = user;
|
||||
@@ -33,7 +34,7 @@ public class PreChatFormatEvent implements CarbonEvent, Cancellable {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser user() {
|
||||
public @NonNull PlayerUser user() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.event.Cancellable;
|
||||
@@ -8,14 +8,14 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class PrivateMessageEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private @NonNull final ChatUser sender;
|
||||
private @NonNull final ChatUser target;
|
||||
private @NonNull final CarbonUser sender;
|
||||
private @NonNull final CarbonUser target;
|
||||
private @NonNull final Component senderComponent;
|
||||
private @NonNull final Component targetComponent;
|
||||
private @NonNull final String message;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public PrivateMessageEvent(@NonNull final ChatUser sender, @NonNull final ChatUser target,
|
||||
public PrivateMessageEvent(@NonNull final CarbonUser sender, @NonNull final CarbonUser target,
|
||||
@NonNull final Component senderComponent, @NonNull final Component targetComponent,
|
||||
@NonNull final String message) {
|
||||
|
||||
@@ -36,11 +36,11 @@ public class PrivateMessageEvent implements CarbonEvent, Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser sender() {
|
||||
public @NonNull CarbonUser sender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser target() {
|
||||
public @NonNull CarbonUser target() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -1,20 +1,22 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ReceiverContextEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private @NonNull final TextChannel channel;
|
||||
private @NonNull final ChatUser sender;
|
||||
private @NonNull final ChatUser recipient;
|
||||
private @NonNull final PlayerUser sender;
|
||||
private @NonNull final PlayerUser recipient;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public ReceiverContextEvent(@NonNull final TextChannel channel, @NonNull final ChatUser sender, @NonNull final ChatUser recipient) {
|
||||
public ReceiverContextEvent(@NonNull final TextChannel channel, @NonNull final PlayerUser sender,
|
||||
@NonNull final PlayerUser recipient) {
|
||||
this.channel = channel;
|
||||
this.sender = sender;
|
||||
this.recipient = recipient;
|
||||
@@ -38,11 +40,11 @@ public class ReceiverContextEvent implements CarbonEvent, Cancellable {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser sender() {
|
||||
public @NonNull PlayerUser sender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser recipient() {
|
||||
public @NonNull PlayerUser recipient() {
|
||||
return this.recipient;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.kyori.event.Cancellable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class UserEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private @NonNull final ChatUser user;
|
||||
private @NonNull final CarbonUser user;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public UserEvent(@NonNull final ChatUser user) {
|
||||
public UserEvent(@NonNull final CarbonUser user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public @NonNull ChatUser user() {
|
||||
public @NonNull CarbonUser user() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ public class UserEvent implements CarbonEvent, Cancellable {
|
||||
}
|
||||
|
||||
public static class Join extends UserEvent {
|
||||
public Join(@NonNull final ChatUser user) {
|
||||
public Join(@NonNull final CarbonUser user) {
|
||||
super(user);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Leave extends UserEvent {
|
||||
public Leave(@NonNull final ChatUser user) {
|
||||
public Leave(@NonNull final CarbonUser user) {
|
||||
super(user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.draycia.carbon.api.messaging;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -11,7 +11,7 @@ import java.util.function.Consumer;
|
||||
|
||||
public interface MessageService {
|
||||
|
||||
void registerUserMessageListener(@NonNull final String key, @NonNull final BiConsumer<@NonNull ChatUser, @NonNull ByteArrayDataInput> listener);
|
||||
void registerUserMessageListener(@NonNull final String key, @NonNull final BiConsumer<@NonNull CarbonUser, @NonNull ByteArrayDataInput> listener);
|
||||
|
||||
void registerUUIDMessageListener(@NonNull final String key, @NonNull final BiConsumer<@NonNull UUID, @NonNull ByteArrayDataInput> listener);
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.draycia.carbon.api.users;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface CarbonUser extends Audience {
|
||||
|
||||
boolean hasPermission(@NonNull String permission);
|
||||
|
||||
@NonNull String name();
|
||||
|
||||
@Nullable ChatChannel selectedChannel();
|
||||
|
||||
default void selectedChannel(@NonNull final ChatChannel channel) {
|
||||
this.selectedChannel(channel, false);
|
||||
}
|
||||
|
||||
void selectedChannel(@NonNull ChatChannel channel, boolean fromRemote);
|
||||
|
||||
void clearSelectedChannel();
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.draycia.carbon.api.users;
|
||||
|
||||
public interface ConsoleUser extends ChatUser {
|
||||
public interface ConsoleUser extends CarbonUser {
|
||||
}
|
||||
+8
-26
@@ -1,7 +1,6 @@
|
||||
package net.draycia.carbon.api.users;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -10,17 +9,12 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ChatUser extends Audience {
|
||||
public interface PlayerUser extends CarbonUser {
|
||||
|
||||
@NonNull UUID uuid();
|
||||
|
||||
@Deprecated
|
||||
boolean permissible();
|
||||
|
||||
boolean online();
|
||||
|
||||
boolean hasPermission(@NonNull String permission);
|
||||
|
||||
@Nullable String nickname();
|
||||
|
||||
default void nickname(@Nullable final String nickname) {
|
||||
@@ -33,18 +27,6 @@ public interface ChatUser extends Audience {
|
||||
|
||||
void displayName(@Nullable String displayName);
|
||||
|
||||
@NonNull String name();
|
||||
|
||||
@Nullable ChatChannel selectedChannel();
|
||||
|
||||
default void selectedChannel(@NonNull final ChatChannel channel) {
|
||||
this.selectedChannel(channel, false);
|
||||
}
|
||||
|
||||
void selectedChannel(@NonNull ChatChannel channel, boolean fromRemote);
|
||||
|
||||
void clearSelectedChannel();
|
||||
|
||||
@NonNull UserChannelSettings channelSettings(@NonNull ChatChannel channel);
|
||||
|
||||
@NonNull Map<@NonNull String, @NonNull ? extends UserChannelSettings> channelSettings();
|
||||
@@ -79,13 +61,13 @@ public interface ChatUser extends Audience {
|
||||
this.replyTarget(target, false);
|
||||
}
|
||||
|
||||
default void replyTarget(@Nullable final ChatUser user) {
|
||||
default void replyTarget(@Nullable final PlayerUser 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(@Nullable final PlayerUser user, final boolean fromRemote) {
|
||||
this.replyTarget(user.uuid(), fromRemote);
|
||||
}
|
||||
|
||||
@@ -97,19 +79,19 @@ public interface ChatUser extends Audience {
|
||||
this.ignoringUser(uuid, ignoring, false);
|
||||
}
|
||||
|
||||
default boolean ignoringUser(@NonNull final ChatUser user) {
|
||||
default boolean ignoringUser(@NonNull final PlayerUser user) {
|
||||
return this.ignoringUser(user.uuid());
|
||||
}
|
||||
|
||||
default void ignoringUser(@NonNull final ChatUser user, final boolean ignoring, final boolean fromRemote) {
|
||||
default void ignoringUser(@NonNull final PlayerUser user, final boolean ignoring, final boolean fromRemote) {
|
||||
this.ignoringUser(user.uuid(), ignoring, fromRemote);
|
||||
}
|
||||
|
||||
default void ignoringUser(@NonNull final ChatUser user, final boolean ignoring) {
|
||||
default void ignoringUser(@NonNull final PlayerUser user, final boolean ignoring) {
|
||||
this.ignoringUser(user.uuid(), ignoring, false);
|
||||
}
|
||||
|
||||
@NonNull Iterable<ChatUser> ignoredChatUsers();
|
||||
@NonNull Iterable<CarbonUser> ignoredChatUsers();
|
||||
|
||||
@NonNull Iterable<UUID> ignoredUsers();
|
||||
|
||||
@@ -121,6 +103,6 @@ public interface ChatUser extends Audience {
|
||||
|
||||
@Nullable Group primaryGroup();
|
||||
|
||||
void sendMessage(@NonNull final ChatUser sender, @NonNull String message);
|
||||
void sendMessage(@NonNull final PlayerUser sender, @NonNull String message);
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface UserService<T extends ChatUser> {
|
||||
public interface UserService<T extends PlayerUser> {
|
||||
|
||||
@Nullable
|
||||
UUID resolve(String name);
|
||||
|
||||
Reference in new issue
Block a user