Archived
0

Added appendMessage

This commit is contained in:
Minenash 2018-12-12 17:00:02 -05:00
parent 3848d2db31
commit 81422fe3ce

View File

@ -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,