Skip to content

Commit

Permalink
implement sendMessage with signedmessage (from system only)
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Dec 8, 2022
1 parent 804c769 commit f9fb335
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.chat.SignedMessage;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.pointer.Pointers;
import net.kyori.adventure.sound.Sound;
Expand Down Expand Up @@ -196,7 +197,7 @@ public void sendMessage(final @NotNull Identity source, final @NotNull Component
}

@Override
public void sendMessage(@NotNull final Component original, final ChatType.@NotNull Bound boundChatType) {
public void sendMessage(final @NotNull Component original, final ChatType.@NotNull Bound boundChatType) {
if (this.chat == null) return;
final Object message = this.createMessage(original, this.chat);
if (message == null) return;
Expand All @@ -213,6 +214,16 @@ public void sendMessage(@NotNull final Component original, final ChatType.@NotNu
}
}

@Override
public void sendMessage(final @NotNull SignedMessage signedMessage, final ChatType.@NotNull Bound boundChatType) {
if (signedMessage.isSystem()) {
final Component content = signedMessage.unsignedContent() != null ? signedMessage.unsignedContent() : Component.text(signedMessage.message());
this.sendMessage(content, boundChatType);
} else {
Audience.super.sendMessage(signedMessage, boundChatType);
}
}

@Override
public void sendActionBar(final @NotNull Component original) {
if (this.actionBar == null) return;
Expand Down

0 comments on commit f9fb335

Please sign in to comment.