diff --git a/src/main/java/net/nemez/chatapi/click/Message.java b/src/main/java/net/nemez/chatapi/click/Message.java index 45f6094..f327080 100644 --- a/src/main/java/net/nemez/chatapi/click/Message.java +++ b/src/main/java/net/nemez/chatapi/click/Message.java @@ -3,6 +3,7 @@ package net.nemez.chatapi.click; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -158,6 +159,12 @@ public class Message } } + public Message appendMessage(Message msg) { + message.addExtra(msg.message); + rawMessage += msg.rawMessage; + return this; + } + public void send() { if (sender == null || !ChatAPI.canChat(this.permission)) @@ -174,6 +181,22 @@ public class Message } } + public void sendAsActionBar() + { + if (sender == null) + { + return; + } + if (sender instanceof Player) + { + ((Player) sender).spigot().sendMessage(ChatMessageType.ACTION_BAR, message); + } + else + { + sender.sendMessage(rawMessage); + } + } + private void addHoverText(BaseComponent comp, String text) { comp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,