mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Misc cleanup and improvements
This commit is contained in:
1 parent
fe4e84d375
commit
1d0fa05a46
15 files changed
+246
-58
No files matched your search
@@ -24,6 +24,7 @@ import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.api.util.KeyedRenderer;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.chat.SignedMessage;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -44,10 +45,10 @@ public class CarbonChatEvent implements ResultedCarbonEvent<CarbonChatEvent.Resu
|
||||
private final CarbonPlayer sender;
|
||||
private final Component originalMessage;
|
||||
private final List<? extends Audience> recipients;
|
||||
private final @Nullable ChatChannel chatChannel;
|
||||
private final @MonotonicNonNull ChatChannel chatChannel;
|
||||
private final @MonotonicNonNull SignedMessage signedMessage;
|
||||
private Component message;
|
||||
private Result result = Result.ALLOWED;
|
||||
private final boolean previewing;
|
||||
|
||||
/**
|
||||
* {@link ResultedCarbonEvent} that's called when players send messages in chat.
|
||||
@@ -57,7 +58,7 @@ public class CarbonChatEvent implements ResultedCarbonEvent<CarbonChatEvent.Resu
|
||||
* @param recipients the recipients of the message
|
||||
* @param renderers the renderers of the message
|
||||
* @param chatChannel the channel the message was sent in
|
||||
* @param previewing if the message is being previewed by the player
|
||||
* @param signedMessage the signature information for the message, if present
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public CarbonChatEvent(
|
||||
@@ -66,7 +67,7 @@ public class CarbonChatEvent implements ResultedCarbonEvent<CarbonChatEvent.Resu
|
||||
final List<? extends Audience> recipients,
|
||||
final List<KeyedRenderer> renderers,
|
||||
final @Nullable ChatChannel chatChannel,
|
||||
final boolean previewing
|
||||
final @Nullable SignedMessage signedMessage
|
||||
) {
|
||||
this.sender = sender;
|
||||
this.originalMessage = originalMessage;
|
||||
@@ -74,7 +75,7 @@ public class CarbonChatEvent implements ResultedCarbonEvent<CarbonChatEvent.Resu
|
||||
this.recipients = recipients;
|
||||
this.renderers = renderers;
|
||||
this.chatChannel = chatChannel;
|
||||
this.previewing = previewing;
|
||||
this.signedMessage = signedMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,8 +94,8 @@ public class CarbonChatEvent implements ResultedCarbonEvent<CarbonChatEvent.Resu
|
||||
* @return if the message is being previewed
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public boolean previewing() {
|
||||
return this.previewing;
|
||||
public @MonotonicNonNull SignedMessage signedMessage() {
|
||||
return this.signedMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -268,15 +268,6 @@ public interface CarbonPlayer extends Audience, Identified {
|
||||
*/
|
||||
void sendMessageAsPlayer(final String message);
|
||||
|
||||
/**
|
||||
* Checks if the player is allowed to send the message or not.
|
||||
*
|
||||
* @param message the message
|
||||
* @return if the message can be sent in chat
|
||||
* @since 2.0.4
|
||||
*/
|
||||
boolean speechPermitted(final String message);
|
||||
|
||||
/**
|
||||
* Returns whether the player is online.
|
||||
*
|
||||
|
||||
@@ -160,11 +160,6 @@ class EmptyCarbonPlayer implements CarbonPlayer {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean speechPermitted(final String message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean online() {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user