Trigger bukkit chat events when using message commands

This commit is contained in:
Draycia committed 2021-12-17 21:56:59 -08:00
1 parent 6e0f946337
commit 2c8e26a491
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);
}
}