mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Refactor ChatUser
This commit is contained in:
1 parent
f9515f98fb
commit
941d7ee096
56 files changed
+455
-354
No files matched your search
@@ -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