mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Progress on CarbonChat-Common
This commit is contained in:
1 parent
508ad88e26
commit
64295c84ea
60 files changed
+889
-556
No files matched your search
@@ -3,7 +3,7 @@ package net.draycia.carbon.util;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -11,9 +11,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
|
||||
public CarbonPlaceholders(@NonNull final CarbonChat carbonChat) {
|
||||
public CarbonPlaceholders(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
if (key.startsWith("can_use_")) {
|
||||
final String value = key.replace("can_use_", "");
|
||||
|
||||
final ChatChannel channel = this.carbonChat.channelManager().registry().get(value);
|
||||
final ChatChannel channel = this.carbonChat.channelRegistry().get(value);
|
||||
|
||||
if (channel == null) {
|
||||
return "false";
|
||||
@@ -60,7 +60,7 @@ public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
} else if (key.startsWith("can_see_")) {
|
||||
final String value = key.replace("can_see_", "");
|
||||
|
||||
final ChatChannel channel = this.carbonChat.channelManager().registry().get(value);
|
||||
final ChatChannel channel = this.carbonChat.channelRegistry().get(value);
|
||||
|
||||
if (channel == null) {
|
||||
return "false";
|
||||
@@ -72,7 +72,7 @@ public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
} else if (key.startsWith("ignoring_channel_")) {
|
||||
final String value = key.replace("ignoring_channel_", "");
|
||||
|
||||
final ChatChannel channel = this.carbonChat.channelManager().registry().get(value);
|
||||
final ChatChannel channel = this.carbonChat.channelRegistry().get(value);
|
||||
|
||||
if (channel == null) {
|
||||
return "false";
|
||||
@@ -84,7 +84,7 @@ public class CarbonPlaceholders extends PlaceholderExpansion {
|
||||
} else if (key.startsWith("selected_channel")) {
|
||||
final ChatChannel channel = this.carbonChat.userService().wrap(player.getUniqueId()).selectedChannel();
|
||||
|
||||
return channel == null ? this.carbonChat.channelManager().defaultChannel().name() : channel.name();
|
||||
return channel == null ? this.carbonChat.channelRegistry().defaultChannel().name() : channel.name();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -23,7 +23,7 @@ package net.draycia.carbon.util;
|
||||
import dev.jorel.commandapi.arguments.Argument;
|
||||
import dev.jorel.commandapi.arguments.CustomArgument;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -136,7 +136,7 @@ public final class CarbonUtils {
|
||||
@NonNull
|
||||
public static Argument onlineChatUserArgument() {
|
||||
return new CustomArgument<>(input -> {
|
||||
final CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
final CarbonChatBukkit carbonChat = (CarbonChatBukkit) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
|
||||
final Player player = Bukkit.getPlayer(input);
|
||||
|
||||
@@ -159,7 +159,7 @@ public final class CarbonUtils {
|
||||
@NonNull
|
||||
public static Argument chatUserArgument() {
|
||||
return new CustomArgument<>(input -> {
|
||||
final CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
final CarbonChatBukkit carbonChat = (CarbonChatBukkit) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
|
||||
return carbonChat.userService().wrap(Bukkit.getOfflinePlayer(input).getUniqueId());
|
||||
// }).overrideSuggestions((sender, args) -> {
|
||||
@@ -189,9 +189,9 @@ public final class CarbonUtils {
|
||||
@NonNull
|
||||
public static Argument channelArgument() {
|
||||
return new CustomArgument<>(input -> {
|
||||
final CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
final CarbonChatBukkit carbonChat = (CarbonChatBukkit) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
||||
|
||||
final ChatChannel channel = carbonChat.channelManager().registry().get(input);
|
||||
final ChatChannel channel = carbonChat.channelRegistry().get(input);
|
||||
|
||||
if (channel == null) {
|
||||
throw new CustomArgument.CustomArgumentException("Invalid channel for input (" + input + ")");
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package net.draycia.carbon.util;
|
||||
|
||||
import io.lettuce.core.pubsub.RedisPubSubListener;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface RedisListener extends RedisPubSubListener<String, String> {
|
||||
|
||||
@Override
|
||||
void message(@NonNull String channel, @NonNull String message);
|
||||
|
||||
@Override
|
||||
default void message(@NonNull final String pattern, @NonNull final String channel, @NonNull final String message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void subscribed(@NonNull final String channel, final long count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void psubscribed(@NonNull final String pattern, final long count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void unsubscribed(@NonNull final String channel, final long count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void punsubscribed(@NonNull final String pattern, final long count) {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user