Fixed hover info for Discord
This commit is contained in:
parent
01562bf769
commit
e6ac18e0c7
2 changed files with 7 additions and 7 deletions
|
@ -128,7 +128,7 @@ public class ChatProcessing {
|
||||||
pingedconsole = false; // Will set it to true onmatch (static constructor)
|
pingedconsole = false; // Will set it to true onmatch (static constructor)
|
||||||
final String channelidentifier = getChannelID(channel, sender);
|
final String channelidentifier = getChannelID(channel, sender);
|
||||||
|
|
||||||
TellrawPart json = createTellraw(sender, message, player, mp, channelidentifier);
|
TellrawPart json = createTellraw(sender, message, player, mp, e.getUser(), channelidentifier);
|
||||||
long combinetime = System.nanoTime();
|
long combinetime = System.nanoTime();
|
||||||
ChatFormatter.Combine(formatters, message, json);
|
ChatFormatter.Combine(formatters, message, json);
|
||||||
combinetime = System.nanoTime() - combinetime;
|
combinetime = System.nanoTime() - combinetime;
|
||||||
|
@ -191,8 +191,8 @@ public class ChatProcessing {
|
||||||
return gson.toJson(json);
|
return gson.toJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TellrawPart createTellraw(CommandSender sender, String message, @Nullable Player player, @Nullable ChatPlayer mp,
|
static TellrawPart createTellraw(CommandSender sender, String message, @Nullable Player player,
|
||||||
final String channelidentifier) {
|
@Nullable ChatPlayer mp, @Nullable ChromaGamerBase cg, final String channelidentifier) {
|
||||||
TellrawPart json = new TellrawPart("");
|
TellrawPart json = new TellrawPart("");
|
||||||
if (mp != null && mp.ChatOnly) {
|
if (mp != null && mp.ChatOnly) {
|
||||||
json.addExtra(new TellrawPart("[C]")
|
json.addExtra(new TellrawPart("[C]")
|
||||||
|
@ -213,8 +213,8 @@ public class ChatProcessing {
|
||||||
.setHoverEvent(TellrawEvent.create(TellrawEvent.HoverAction.SHOW_TEXT, "Gold Patreon supporter")));
|
.setHoverEvent(TellrawEvent.create(TellrawEvent.HoverAction.SHOW_TEXT, "Gold Patreon supporter")));
|
||||||
json.addExtra(new TellrawPart(" <"));
|
json.addExtra(new TellrawPart(" <"));
|
||||||
TellrawPart hovertp = new TellrawPart("");
|
TellrawPart hovertp = new TellrawPart("");
|
||||||
if (mp != null)
|
if (cg != null)
|
||||||
hovertp.addExtra(new TellrawPart(mp.getInfo(ChromaGamerBase.InfoTarget.MCHover)));
|
hovertp.addExtra(new TellrawPart(cg.getInfo(ChromaGamerBase.InfoTarget.MCHover)));
|
||||||
json.addExtra(new TellrawPart(getSenderName(sender, player))
|
json.addExtra(new TellrawPart(getSenderName(sender, player))
|
||||||
.setHoverEvent(TellrawEvent.create(TellrawEvent.HoverAction.SHOW_TEXT, hovertp)));
|
.setHoverEvent(TellrawEvent.create(TellrawEvent.HoverAction.SHOW_TEXT, hovertp)));
|
||||||
json.addExtra(new TellrawPart("> "));
|
json.addExtra(new TellrawPart("> "));
|
||||||
|
|
|
@ -66,11 +66,11 @@ public class ChatFormatIT {
|
||||||
public void testMessage() {
|
public void testMessage() {
|
||||||
ArrayList<ChatFormatter> cfs = ChatProcessing.addFormatters(Color.White);
|
ArrayList<ChatFormatter> cfs = ChatProcessing.addFormatters(Color.White);
|
||||||
final String chid = ChatProcessing.getChannelID(Channel.GlobalChat, sender);
|
final String chid = ChatProcessing.getChannelID(Channel.GlobalChat, sender);
|
||||||
final TellrawPart tp = ChatProcessing.createTellraw(sender, message, null, null, chid);
|
final TellrawPart tp = ChatProcessing.createTellraw(sender, message, null, null, null, chid);
|
||||||
ChatFormatter.Combine(cfs, message, tp);
|
ChatFormatter.Combine(cfs, message, tp);
|
||||||
System.out.println("Testing: " + message);
|
System.out.println("Testing: " + message);
|
||||||
// System.out.println(ChatProcessing.toJson(tp));
|
// System.out.println(ChatProcessing.toJson(tp));
|
||||||
final TellrawPart expectedtp = ChatProcessing.createTellraw(sender, message, null, null, chid);
|
final TellrawPart expectedtp = ChatProcessing.createTellraw(sender, message, null, null, null, chid);
|
||||||
// System.out.println("Raw: " + ChatProcessing.toJson(expectedtp));
|
// System.out.println("Raw: " + ChatProcessing.toJson(expectedtp));
|
||||||
for (TellrawPart extra : extras)
|
for (TellrawPart extra : extras)
|
||||||
expectedtp.addExtra(extra);
|
expectedtp.addExtra(extra);
|
||||||
|
|
Loading…
Reference in a new issue