mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-15 12:41:36 +01:00
Fixed newline at the end of hover messages
This commit is contained in:
parent
7e34084b85
commit
d197e588ee
@ -19,6 +19,7 @@ package com.djrapitops.plan.commands.use;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -78,9 +79,7 @@ class BukkitPartBuilder implements MessageBuilder {
|
||||
@Override
|
||||
public MessageBuilder hover(Collection<String> lines) {
|
||||
ComponentBuilder hoverMsg = new ComponentBuilder("");
|
||||
for (String line : lines) {
|
||||
hoverMsg.append(line + "\n");
|
||||
}
|
||||
hoverMsg.append(new TextStringBuilder().appendWithSeparators(lines, "\n").build());
|
||||
part.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverMsg.create()));
|
||||
return this;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.djrapitops.plan.commands.use.MessageBuilder;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -79,9 +80,7 @@ class BungeePartBuilder implements MessageBuilder {
|
||||
@Override
|
||||
public MessageBuilder hover(Collection<String> lines) {
|
||||
ComponentBuilder hoverMsg = new ComponentBuilder("");
|
||||
for (String line : lines) {
|
||||
hoverMsg.append(line + "\n");
|
||||
}
|
||||
hoverMsg.append(new TextStringBuilder().appendWithSeparators(lines, "\n").build());
|
||||
part.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverMsg.create()));
|
||||
return this;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package com.djrapitops.plan.commands.use;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.event.ClickEvent;
|
||||
import net.kyori.text.event.HoverEvent;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -73,11 +74,9 @@ public class VelocityMessageBuilder implements MessageBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBuilder hover(Collection<String> collection) {
|
||||
public MessageBuilder hover(Collection<String> lines) {
|
||||
TextComponent.Builder hoverText = TextComponent.builder();
|
||||
for (String string : collection) {
|
||||
hoverText.content(string);
|
||||
}
|
||||
hoverText.content(new TextStringBuilder().appendWithSeparators(lines, "\n").build());
|
||||
builder.hoverEvent(HoverEvent.showText(hoverText.build()));
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user