Properly escape pipe character on item lore (#2994)

Using negative lookbehind instead of negated characters set.

Fixes #2962, fixes #2984
This commit is contained in:
imDaniX 2020-02-07 13:10:54 +03:00 committed by GitHub
parent 129650dade
commit 13f454a022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,8 +162,8 @@ public class MetaItemStack {
stack.setItemMeta(meta);
} else if (split.length > 1 && (split[0].equalsIgnoreCase("lore") || split[0].equalsIgnoreCase("desc")) && hasMetaPermission(sender, "lore", false, true, ess)) {
final List<String> lore = new ArrayList<String>();
for (String line : split[1].split("[^\\\\](\\|)")) {
lore.add(FormatUtil.replaceFormat(line.replace('_', ' ')));
for (String line : split[1].split("(?<!\\\\)\\|")) {
lore.add(FormatUtil.replaceFormat(line.replace('_', ' ').replace("\\|", "|")));
}
final ItemMeta meta = stack.getItemMeta();
meta.setLore(lore);