Merge remote-tracking branch 'origin/action_bar'
This commit is contained in:
commit
48793edd53
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.nemez.chatapi.click.CallbackCommand;
|
import net.nemez.chatapi.click.CallbackCommand;
|
||||||
import net.nemez.chatapi.click.Message;
|
import net.nemez.chatapi.click.Message;
|
||||||
import net.nemez.chatapi.click.PlayerQuitListener;
|
import net.nemez.chatapi.click.PlayerQuitListener;
|
||||||
@ -103,7 +104,7 @@ public class ChatAPI
|
|||||||
{
|
{
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
sender.spigot().sendMessage(new TextComponent(colorify(sender, message)));
|
((Player) sender).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(colorify(sender, message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package net.nemez.chatapi.click;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
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()
|
public void send()
|
||||||
{
|
{
|
||||||
if (sender == null || !ChatAPI.canChat(this.permission))
|
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)
|
private void addHoverText(BaseComponent comp, String text)
|
||||||
{
|
{
|
||||||
comp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
comp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||||
|
Reference in New Issue
Block a user