mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-24 12:16:36 +01:00
Fixed item names containing vertical bars displaying incorrectly (fixes #450)
This commit is contained in:
parent
d944c2bd89
commit
e49913bc09
@ -82,4 +82,8 @@ public class SpigotAdapter implements SpigotInterface {
|
|||||||
|
|
||||||
Chat.sendMessage(sender, message.toString());
|
Chat.sendMessage(sender, message.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String processComponent(String component) {
|
||||||
|
return component.replace(Chat.COMPONENT_PIPE, "|");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class Spigot_v1_16 extends SpigotHandler implements SpigotInterface {
|
|||||||
try {
|
try {
|
||||||
if (Config.getGlobal().HOVER_EVENTS) {
|
if (Config.getGlobal().HOVER_EVENTS) {
|
||||||
TextComponent component = new TextComponent(TextComponent.fromLegacyText(data[2]));
|
TextComponent component = new TextComponent(TextComponent.fromLegacyText(data[2]));
|
||||||
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(TextComponent.fromLegacyText(data[1]))));
|
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(TextComponent.fromLegacyText(processComponent(data[1])))));
|
||||||
((TextComponent) message).addExtra(component);
|
((TextComponent) message).addExtra(component);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -17,6 +17,7 @@ public final class Chat {
|
|||||||
public static final String COMPONENT_TAG_CLOSE = "</COMPONENT>";
|
public static final String COMPONENT_TAG_CLOSE = "</COMPONENT>";
|
||||||
public static final String COMPONENT_COMMAND = "COMMAND";
|
public static final String COMPONENT_COMMAND = "COMMAND";
|
||||||
public static final String COMPONENT_POPUP = "POPUP";
|
public static final String COMPONENT_POPUP = "POPUP";
|
||||||
|
public static final String COMPONENT_PIPE = "<PIPE/>";
|
||||||
|
|
||||||
private Chat() {
|
private Chat() {
|
||||||
throw new IllegalStateException("Utility class");
|
throw new IllegalStateException("Utility class");
|
||||||
|
@ -304,7 +304,7 @@ public class Util extends Queue {
|
|||||||
StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP);
|
StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP);
|
||||||
|
|
||||||
// tooltip
|
// tooltip
|
||||||
message.append("|" + tooltip + "|");
|
message.append("|" + tooltip.replace("|", Chat.COMPONENT_PIPE) + "|");
|
||||||
|
|
||||||
// chat output
|
// chat output
|
||||||
message.append(phrase);
|
message.append(phrase);
|
||||||
|
Loading…
Reference in New Issue
Block a user