mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add channel whisper functionality (#91)
* ChatChannel -> TextChannel, WhisperChannel, GroupChannel * Add basic whisper channel support * Move WhisperPings into WhisperOptions * Add defaults to WhisperOptions * Various deprecation and refactor fixes * Test and fux bugs
This commit is contained in:
1 parent
14dfcfbf38
commit
f9cac355b6
44 files changed
+797
-304
No files matched your search
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api;
|
||||
|
||||
import net.draycia.carbon.api.adventure.CarbonTranslations;
|
||||
import net.draycia.carbon.api.config.CarbonTranslations;
|
||||
import net.draycia.carbon.api.adventure.MessageProcessor;
|
||||
import net.draycia.carbon.api.channels.ChannelRegistry;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettingsRegistry;
|
||||
@@ -10,6 +10,7 @@ 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.UserService;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.slf4j.Logger;
|
||||
@@ -50,4 +51,6 @@ public interface CarbonChat {
|
||||
|
||||
@NonNull ModerationSettings moderationSettings();
|
||||
|
||||
@NonNull GsonComponentSerializer gsonSerializer();
|
||||
|
||||
}
|
||||
@@ -21,8 +21,10 @@ public class ChannelRegistry implements Registry<String, ChatChannel> {
|
||||
public @NonNull ChatChannel register(final @NonNull String key, final @NonNull ChatChannel value) {
|
||||
this.registry.putIfAbsent(key, value);
|
||||
|
||||
if (this.defaultChannel == null && value.isDefault()) {
|
||||
this.defaultChannel = value;
|
||||
if (value instanceof TextChannel) {
|
||||
if (this.defaultChannel == null && ((TextChannel) value).isDefault()) {
|
||||
this.defaultChannel = value;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
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;
|
||||
|
||||
@@ -14,13 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public interface ChatChannel extends 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 List<ChatUser> audiences();
|
||||
public interface ChatChannel extends Audience {
|
||||
|
||||
/**
|
||||
* Gets the {@link TextColor} the supplied {@link ChatUser} has set for this channel.
|
||||
@@ -30,28 +22,26 @@ public interface ChatChannel extends ForwardingAudience {
|
||||
*/
|
||||
@Nullable 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 String format(@NonNull Group group);
|
||||
@NonNull
|
||||
Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull String message, boolean fromRemote);
|
||||
|
||||
/**
|
||||
* Gets the string format for the specified group.
|
||||
* @param group The group.
|
||||
* @return The string format for the specified group.
|
||||
*/
|
||||
@Nullable String format(@NonNull String group);
|
||||
@NonNull
|
||||
Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull Collection<@NonNull ChatUser> recipients,
|
||||
@NonNull String message, boolean fromRemote);
|
||||
|
||||
boolean canPlayerUse(@NonNull ChatUser user);
|
||||
|
||||
boolean canPlayerSee(@NonNull ChatUser sender, @NonNull ChatUser target, boolean checkSpying);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
boolean isDefault();
|
||||
boolean canPlayerSee(@NonNull ChatUser target, boolean checkSpying);
|
||||
|
||||
void sendComponents(final @NonNull Map<ChatUser, Component> components);
|
||||
|
||||
void sendComponentsAndLog(final @NonNull Map<ChatUser, Component> components);
|
||||
|
||||
@NonNull String name();
|
||||
|
||||
@NonNull String key();
|
||||
|
||||
/**
|
||||
* If this channel can be ignored, such as through the /toggle command.
|
||||
@@ -59,19 +49,7 @@ public interface ChatChannel extends ForwardingAudience {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
boolean crossServer();
|
||||
|
||||
@NonNull String name();
|
||||
|
||||
@NonNull String key();
|
||||
|
||||
@Nullable String messagePrefix();
|
||||
|
||||
@Nullable List<String> aliases();
|
||||
@NonNull List<@NonNull Pattern> itemLinkPatterns();
|
||||
|
||||
@Nullable String switchMessage();
|
||||
|
||||
@@ -91,36 +69,4 @@ public interface ChatChannel extends ForwardingAudience {
|
||||
|
||||
@Nullable String cannotUseMessage();
|
||||
|
||||
boolean primaryGroupOnly();
|
||||
|
||||
boolean honorsRecipientList();
|
||||
|
||||
boolean permissionGroupMatching();
|
||||
|
||||
boolean shouldCancelChatEvent();
|
||||
|
||||
boolean testContext(@NonNull ChatUser sender, @NonNull ChatUser target);
|
||||
|
||||
@NonNull List<@NonNull Pattern> itemLinkPatterns();
|
||||
|
||||
@Nullable Context context(@NonNull String key);
|
||||
|
||||
@NonNull List<@NonNull String> groupOverrides();
|
||||
|
||||
boolean canPlayerUse(@NonNull ChatUser user);
|
||||
|
||||
boolean canPlayerSee(@NonNull ChatUser sender, @NonNull ChatUser target, boolean checkSpying);
|
||||
|
||||
boolean canPlayerSee(@NonNull ChatUser target, boolean checkSpying);
|
||||
|
||||
@NonNull Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull String message, boolean fromBungee);
|
||||
|
||||
@NonNull Map<ChatUser, Component> parseMessage(@NonNull ChatUser user, @NonNull Collection<@NonNull ChatUser> recipients, @NonNull String message, boolean fromBungee);
|
||||
|
||||
void sendComponents(final @NonNull Map<ChatUser, Component> components);
|
||||
|
||||
void sendComponentsAndLog(final @NonNull Map<ChatUser, Component> components);
|
||||
|
||||
void sendComponent(@NonNull ChatUser user, @NonNull Component component);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface GroupChannel extends ChatChannel, ForwardingAudience {
|
||||
|
||||
@NonNull ChatUser owner();
|
||||
|
||||
@Override
|
||||
@NonNull Collection<@NonNull ChatUser> audiences();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: rename this to something that's less... weird?
|
||||
public interface TextChannel extends ChatChannel, ForwardingAudience {
|
||||
|
||||
@Override
|
||||
@NonNull List<@NonNull ChatUser> audiences();
|
||||
|
||||
/**
|
||||
* Gets the string format for the specified group.
|
||||
* @param group The group.
|
||||
* @return The string format for the specified group.
|
||||
*/
|
||||
@Nullable String format(@NonNull Group group);
|
||||
|
||||
/**
|
||||
* Gets the string format for the specified group.
|
||||
* @param group The group.
|
||||
* @return The string format for the specified group.
|
||||
*/
|
||||
@Nullable 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.
|
||||
*/
|
||||
boolean isDefault();
|
||||
|
||||
/**
|
||||
* If this channel syncs between servers, typically through the messaging service.
|
||||
* @return If this channel syncs between servers, typically through the messaging service.
|
||||
*/
|
||||
boolean crossServer();
|
||||
|
||||
@Nullable String messagePrefix();
|
||||
|
||||
@Nullable List<String> aliases();
|
||||
|
||||
boolean primaryGroupOnly();
|
||||
|
||||
boolean honorsRecipientList();
|
||||
|
||||
boolean permissionGroupMatching();
|
||||
|
||||
boolean testContext(@NonNull ChatUser sender, @NonNull ChatUser target);
|
||||
|
||||
@Nullable Context context(@NonNull String key);
|
||||
|
||||
@NonNull List<@NonNull String> groupOverrides();
|
||||
|
||||
void sendComponent(@NonNull ChatUser user, @NonNull Component component);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.draycia.carbon.api.channels;
|
||||
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public interface WhisperChannel extends ChatChannel, ForwardingAudience.Single {
|
||||
|
||||
@NonNull ChatUser sender();
|
||||
|
||||
/**
|
||||
* The recipient for this channel, where messages are sent to.
|
||||
* @return The channel recipient.
|
||||
*/
|
||||
@Override
|
||||
@NonNull ChatUser audience();
|
||||
|
||||
@Override
|
||||
default @NonNull String name() {
|
||||
return "Party";
|
||||
}
|
||||
|
||||
@Override
|
||||
default @NonNull String key() {
|
||||
return "party";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,8 +74,8 @@ public class CarbonSettings {
|
||||
@Setting(comment = "Plays a sound and highlights the message when someone types your name")
|
||||
private @NonNull ChannelPings channelPings = new ChannelPings();
|
||||
|
||||
@Setting(comment = "Plays a sound when receiving private messages with /whisper /msg")
|
||||
private @NonNull WhisperPings whisperPings = new WhisperPings();
|
||||
@Setting(comment = "")
|
||||
private @NonNull WhisperOptions whisperOptions = new WhisperOptions();
|
||||
|
||||
@Setting(comment = "Sets the player's channel to the specified channel when they join" +
|
||||
"\nSet to \"\" or remove to disable" +
|
||||
@@ -132,8 +132,8 @@ public class CarbonSettings {
|
||||
return this.channelPings;
|
||||
}
|
||||
|
||||
public @NonNull WhisperPings whisperPings() {
|
||||
return this.whisperPings;
|
||||
public @NonNull WhisperOptions whisperOptions() {
|
||||
return this.whisperOptions;
|
||||
}
|
||||
|
||||
}
|
||||
+6
-11
@@ -1,4 +1,4 @@
|
||||
package net.draycia.carbon.api.adventure;
|
||||
package net.draycia.carbon.api.config;
|
||||
|
||||
import org.spongepowered.configurate.CommentedConfigurationNode;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
@@ -28,8 +28,6 @@ public class CarbonTranslations {
|
||||
}
|
||||
|
||||
@Setting private String reloaded = "<yellow>Chat config has been reloaded!";
|
||||
@Setting private String messageToOther = "<green>[<gray>Me <gold>-> <gray><target><reset><green>] <message>";
|
||||
@Setting private String messageFromOther = "<green>[<gray><sender><reset> <gold>-> <gray>Me<green>] <message>";
|
||||
@Setting private String otherPlayerOffline = "<red>That player is offline!";
|
||||
@Setting private String spyWhispers = "<yellow>Spy [<gray><sender><reset> <gold>-> <gray><target><reset><yellow>] <message>";
|
||||
@Setting private String noReplyTarget = "<red>You have no one to reply to!";
|
||||
@@ -63,19 +61,12 @@ public class CarbonTranslations {
|
||||
@Setting private String muteExempt = "<red>Player <player> is exempt from being muted!";
|
||||
@Setting private String clearNotify = "<yellow>Chat has been cleared by <player>.";
|
||||
@Setting private String clearExempt = "<yellow>You were exempt from the clear due to your permissions!";
|
||||
@Setting private String cannotWhisperSelf = "<yellow>You cannot whisper yourself!";
|
||||
|
||||
public String reloaded() {
|
||||
return this.reloaded;
|
||||
}
|
||||
|
||||
public String messageToOther() {
|
||||
return this.messageToOther;
|
||||
}
|
||||
|
||||
public String messageFromOther() {
|
||||
return this.messageFromOther;
|
||||
}
|
||||
|
||||
public String otherPlayerOffline() {
|
||||
return this.otherPlayerOffline;
|
||||
}
|
||||
@@ -208,4 +199,8 @@ public class CarbonTranslations {
|
||||
return this.clearExempt;
|
||||
}
|
||||
|
||||
public String cannotWhisperSelf() {
|
||||
return this.cannotWhisperSelf;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,6 +103,8 @@ public class ChannelOptions {
|
||||
settings.key = "global";
|
||||
settings.isDefault = true;
|
||||
settings.name = "Global";
|
||||
settings.color = "#FFFFFF";
|
||||
settings.defaultFormatName = "default";
|
||||
settings.formats = Collections.singletonMap("default", "<color><<displayname><reset><color>> <message>");
|
||||
|
||||
return settings;
|
||||
|
||||
@@ -12,7 +12,7 @@ public final class ChannelPings {
|
||||
@Setting private @NonNull String prefix = "";
|
||||
@Setting private boolean caseSensitive = false;
|
||||
@Setting private @NonNull Key sound =
|
||||
Key.of(Key.MINECRAFT_NAMESPACE, "entity.experience_orb.pickup");
|
||||
Key.key(Key.MINECRAFT_NAMESPACE, "entity.experience_orb.pickup");
|
||||
@Setting private Sound.Source source = Sound.Source.PLAYER;
|
||||
@Setting private float volume = 10.0F;
|
||||
@Setting private float pitch = 1.0F;
|
||||
|
||||
@@ -30,7 +30,8 @@ public class ChannelSettings {
|
||||
MAPPER.bind(this).serialize(node);
|
||||
}
|
||||
|
||||
@Setting(comment = "All options here act like the defaults for all channels.\nAdding any of these options to any channel overrides the relevant defaults.")
|
||||
@Setting(comment = "All options here act like the defaults for all channels.\n" +
|
||||
"Adding any of these options to any channel overrides the relevant defaults.")
|
||||
private SharedChannelOptions sharedChannelOptions = new SharedChannelOptions();
|
||||
|
||||
@Setting
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package net.draycia.carbon.api.config;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.objectmapping.Setting;
|
||||
import org.spongepowered.configurate.serialize.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public class WhisperOptions {
|
||||
|
||||
@Setting(comment = "Plays a sound when receiving private messages with /whisper /msg")
|
||||
private @NonNull WhisperPings pings = new WhisperPings();
|
||||
|
||||
@Setting(comment = "")
|
||||
private String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String switchOtherMessage = "<gray><player> <reset><gray>is now in <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String switchFailureMessage = "<red>You cannot use channel <channel>!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String toggleOnMessage = "<gray>You can now see <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String toggleOffMessage = "<gray>You can no longer see <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String toggleOtherOnMessage = "<gray><player> <reset><gray>can now see <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String toggleOtherOffMessage = "<gray><player> <reset><gray>can no longer see <color><channel> <gray>chat!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String cannotUseMessage = "You cannot use that channel!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String cannotIgnoreMessage = "<red>You cannot ignore that channel!";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String senderFormat = "<gold>[<white>Me <gray>-> <white><receiver><gold>] <message>";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String receiverFormat = "<gold>[<white><sender> <gray>-> <white>Me<gold>] <message>";
|
||||
|
||||
@Setting(comment = "")
|
||||
private String consoleFormat = "<gold>[<white><sender> <gray>-> <white><receiver><gold>] <message>";
|
||||
|
||||
@Setting(comment = "")
|
||||
private boolean logToConsole = true;
|
||||
|
||||
public boolean logToConsole() {
|
||||
return this.logToConsole;
|
||||
}
|
||||
|
||||
public @NonNull WhisperPings pings() {
|
||||
return this.pings;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String consoleFormat() {
|
||||
return this.consoleFormat;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String senderFormat() {
|
||||
return this.senderFormat;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String receiverFormat() {
|
||||
return this.receiverFormat;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String switchMessage() {
|
||||
return this.switchMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String switchOtherMessage() {
|
||||
return this.switchOtherMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String switchFailureMessage() {
|
||||
return this.switchFailureMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String cannotIgnoreMessage() {
|
||||
return this.cannotIgnoreMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String toggleOffMessage() {
|
||||
return this.toggleOffMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String toggleOnMessage() {
|
||||
return this.toggleOnMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String toggleOtherOnMessage() {
|
||||
return this.toggleOtherOnMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String toggleOtherOffMessage() {
|
||||
return this.toggleOtherOffMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String cannotUseMessage() {
|
||||
return this.cannotUseMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,29 +8,22 @@ import org.spongepowered.configurate.serialize.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public final class WhisperPings {
|
||||
|
||||
@Setting private boolean enabled = true;
|
||||
@Setting private @NonNull Key sound = Key.of(Key.MINECRAFT_NAMESPACE, "entity.experience_orb.pickup");
|
||||
@Setting private Sound.Source source = Sound.Source.PLAYER;
|
||||
@Setting private float volume = 10.0F;
|
||||
@Setting private float pitch = 1.0F;
|
||||
|
||||
@Setting private @NonNull Sound sound = Sound.sound(
|
||||
Key.key(Key.MINECRAFT_NAMESPACE, "entity.experience_orb.pickup"),
|
||||
Sound.Source.PLAYER,
|
||||
10.0F,
|
||||
1.0F
|
||||
);
|
||||
|
||||
public boolean enabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public Key sound() {
|
||||
public Sound sound() {
|
||||
return this.sound;
|
||||
}
|
||||
|
||||
public Sound.Source source() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public float volume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public float pitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
@@ -9,11 +9,11 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class MessageContextEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private final @NonNull ChatChannel channel;
|
||||
private final @NonNull TextChannel channel;
|
||||
private final @NonNull ChatUser user;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public MessageContextEvent(final @NonNull ChatChannel channel, final @NonNull ChatUser user) {
|
||||
public MessageContextEvent(final @NonNull TextChannel channel, final @NonNull ChatUser user) {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class MessageContextEvent implements CarbonEvent, Cancellable {
|
||||
return this.channel.context(key);
|
||||
}
|
||||
|
||||
public @NonNull ChatChannel channel() {
|
||||
public @NonNull TextChannel channel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.api.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.api.Context;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvent;
|
||||
@@ -9,12 +9,12 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ReceiverContextEvent implements CarbonEvent, Cancellable {
|
||||
|
||||
private final @NonNull ChatChannel channel;
|
||||
private final @NonNull TextChannel channel;
|
||||
private final @NonNull ChatUser sender;
|
||||
private final @NonNull ChatUser recipient;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public ReceiverContextEvent(final @NonNull ChatChannel channel, final @NonNull ChatUser sender, final @NonNull ChatUser recipient) {
|
||||
public ReceiverContextEvent(final @NonNull TextChannel channel, final @NonNull ChatUser sender, final @NonNull ChatUser recipient) {
|
||||
this.channel = channel;
|
||||
this.sender = sender;
|
||||
this.recipient = recipient;
|
||||
@@ -34,7 +34,7 @@ public class ReceiverContextEvent implements CarbonEvent, Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public @NonNull ChatChannel channel() {
|
||||
public @NonNull TextChannel channel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface ChatUser extends Audience {
|
||||
|
||||
@NonNull Map<@NonNull String, @NonNull ? extends UserChannelSettings> channelSettings();
|
||||
|
||||
boolean spyingwhispers();
|
||||
boolean spyingWhispers();
|
||||
|
||||
default void spyingWhispers(final boolean spyingWhispers) {
|
||||
this.spyingWhispers(spyingWhispers, false);
|
||||
|
||||
Reference in new issue
Block a user