mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-22 16:37:25 +00:00
Consume everything after lore as lore in MetaItemStack. Fixes #1722.
This commit is contained in:
parent
0a0c45238c
commit
5fa2ce7d9e
1 changed files with 23 additions and 0 deletions
|
@ -7,6 +7,8 @@ import com.earth2me.essentials.utils.FormatUtil;
|
|||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import net.ess3.api.IEssentials;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.FireworkEffect;
|
||||
|
@ -117,6 +119,27 @@ public class MetaItemStack {
|
|||
}
|
||||
|
||||
public void parseStringMeta(final CommandSource sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception {
|
||||
// Make any entries after lore definition become the lore and not parsed.
|
||||
{
|
||||
int loreIndex = -1;
|
||||
boolean dirty = false;
|
||||
for (int i = 0; i < string.length; i++) {
|
||||
String _str = string[i];
|
||||
if (loreIndex == -1) {
|
||||
if (_str.matches("^lore" + splitPattern.pattern() + ".*")) {
|
||||
System.out.println("YES " + _str);
|
||||
loreIndex = i;
|
||||
}
|
||||
} else {
|
||||
string[loreIndex] += " " + string[i];
|
||||
string[i] = null;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
if (dirty) {
|
||||
string = (String[]) ArrayUtils.subarray(string, 0, loreIndex + 1);
|
||||
}
|
||||
}
|
||||
if (string[fromArg].startsWith("{") && hasMetaPermission(sender, "vanilla", false, true, ess)) {
|
||||
try {
|
||||
stack = ess.getServer().getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(string).subList(fromArg, string.length)));
|
||||
|
|
Loading…
Reference in a new issue