multiline permission description fix #24

This commit is contained in:
Flemmli97 2021-01-21 21:12:00 +01:00
parent c64a24757d
commit 6b59f18377
2 changed files with 5 additions and 6 deletions

View File

@ -112,15 +112,14 @@ public class LangConfig {
for (ClaimPermission perm : PermissionRegistry.getPerms()) {
if (obj.has(perm.id + ".desc")) {
JsonElement pe = obj.get(perm.id + ".desc");
if(pe.isJsonObject())
if (pe.isJsonObject())
throw new JsonParseException("Lang cant be json objects");
if(pe.isJsonArray()){
if (pe.isJsonArray()) {
String[] l = new String[pe.getAsJsonArray().size()];
for(int i = 0; i < l.length; i++)
for (int i = 0; i < l.length; i++)
l[i] = pe.getAsJsonArray().get(i).getAsString();
perm.desc = l;
}
else
} else
perm.desc = new String[]{pe.getAsString()};
}
}

View File

@ -29,7 +29,7 @@ public class ServerScreenHelper {
ItemStack stack = perm.getItem();
stack.setCustomName(new LiteralText(perm.id).setStyle(Style.EMPTY.withFormatting(Formatting.GOLD)));
ListTag lore = new ListTag();
for(String pdesc : perm.desc) {
for (String pdesc : perm.desc) {
Text trans = new LiteralText(pdesc).setStyle(Style.EMPTY.withFormatting(Formatting.YELLOW));
lore.add(StringTag.of(Text.Serializer.toJson(trans)));
}