mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Trigger bukkit chat events when using message commands
This commit is contained in:
7 files changed
+45
-2
No files matched your search
@@ -319,6 +319,11 @@ public class CarbonChannelRegistry implements ChannelRegistry, DefaultedRegistry
|
||||
ChatChannel channel,
|
||||
final String plainMessage
|
||||
) {
|
||||
// Should we silent exit here? Chances are whatever caused the
|
||||
if (!sender.speechPermitted(plainMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (final var chatChannel : this) {
|
||||
if (chatChannel.quickPrefix() == null) {
|
||||
continue;
|
||||
|
||||
@@ -172,7 +172,11 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
|
||||
@Override
|
||||
public Set<Audience> filterRecipients(final CarbonPlayer sender, final Set<Audience> recipients) {
|
||||
recipients.removeIf(it -> !this.hearingPermitted(it).permitted());
|
||||
try {
|
||||
recipients.removeIf(it -> !this.hearingPermitted(it).permitted());
|
||||
} catch (final UnsupportedOperationException ignored) {
|
||||
|
||||
}
|
||||
|
||||
return recipients;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,11 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean speechPermitted(final String message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean online() {
|
||||
return false;
|
||||
|
||||
@@ -214,4 +214,9 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
|
||||
return this.carbonPlayerCommon().identity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean speechPermitted(final String message) {
|
||||
return this.carbonPlayerCommon().speechPermitted(message);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user