diff --git a/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java b/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java index aa8075aa..c1403f4e 100644 --- a/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java +++ b/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java @@ -16,6 +16,7 @@ import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit; import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.util.PermUtil; +import com.massivecraft.massivecore.util.Txt; public class CommandEditAbstract extends MassiveCommand { @@ -297,18 +298,36 @@ public class CommandEditAbstract extends MassiveCommand return alias; } - public void show(CommandSender sender) + public void show(int page) { - Mson descProperty = this.getProperty().getDisplayNameMson(); - Mson descObject = this.getObjectVisual(); Mson descValue = this.getInheritedVisual(); - message(mson( - descProperty, - " for ", - descObject, - ": ", - descValue - ).color(ChatColor.GRAY)); + + // For things with line breaks. + if (descValue.contains("\n")) + { + Mson title = mson( + this.getProperty().getDisplayNameMson(), + " for ", + this.getObjectVisual() + ); + List lines = descValue.split(Txt.PATTERN_NEWLINE); + + message(Txt.getPage(lines, page, title, this)); + } + // Others + else + { + Mson descProperty = this.getProperty().getDisplayNameMson(); + Mson descObject = this.getObjectVisual(); + + message(mson( + descProperty, + " for ", + descObject, + ": ", + descValue + ).color(ChatColor.GRAY)); + } } public void requireNullable() throws MassiveException diff --git a/src/com/massivecraft/massivecore/command/editor/CommandEditShow.java b/src/com/massivecraft/massivecore/command/editor/CommandEditShow.java index fa65dad2..2b3465d5 100644 --- a/src/com/massivecraft/massivecore/command/editor/CommandEditShow.java +++ b/src/com/massivecraft/massivecore/command/editor/CommandEditShow.java @@ -1,6 +1,7 @@ package com.massivecraft.massivecore.command.editor; import com.massivecraft.massivecore.MassiveException; +import com.massivecraft.massivecore.command.Parameter; public class CommandEditShow extends CommandEditAbstract { @@ -17,6 +18,9 @@ public class CommandEditShow extends CommandEditAbstract String alias = this.createCommandAlias(); this.setAliases(alias); + // Parameters + this.addParameter(Parameter.getPage()); + // Desc this.setDesc(alias + " " + this.getPropertyName()); } @@ -28,7 +32,8 @@ public class CommandEditShow extends CommandEditAbstract @Override public void perform() throws MassiveException { - this.show(sender); + int page = this.readArg(); + this.show(page); } } diff --git a/src/com/massivecraft/massivecore/command/editor/CommandEditSimple.java b/src/com/massivecraft/massivecore/command/editor/CommandEditSimple.java index ace55295..c0b07742 100644 --- a/src/com/massivecraft/massivecore/command/editor/CommandEditSimple.java +++ b/src/com/massivecraft/massivecore/command/editor/CommandEditSimple.java @@ -32,7 +32,7 @@ public class CommandEditSimple extends CommandEditAbstract // Show if ( ! this.argIsSet(0)) { - this.show(sender); + this.show(0); return; } diff --git a/src/com/massivecraft/massivecore/command/type/container/TypeContainer.java b/src/com/massivecraft/massivecore/command/type/container/TypeContainer.java index 858d8218..ede0817c 100644 --- a/src/com/massivecraft/massivecore/command/type/container/TypeContainer.java +++ b/src/com/massivecraft/massivecore/command/type/container/TypeContainer.java @@ -67,7 +67,7 @@ public abstract class TypeContainer extends TypeAbstract index++; Mson part = Mson.mson( Mson.mson(String.valueOf(index)).color(ChatColor.WHITE), - " ", + Mson.SPACE, innerType.getVisualMson(element, sender) ); parts.add(part); diff --git a/src/com/massivecraft/massivecore/mson/Mson.java b/src/com/massivecraft/massivecore/mson/Mson.java index 6cef8655..2fc1af4b 100644 --- a/src/com/massivecraft/massivecore/mson/Mson.java +++ b/src/com/massivecraft/massivecore/mson/Mson.java @@ -1040,7 +1040,7 @@ public class Mson implements Serializable // Implode simple public static Mson implode(final Object[] list, final Mson glue, final Mson format) - { + { List parts = new MassiveList<>(); for (int i = 0; i < list.length; i++) { @@ -1057,6 +1057,7 @@ public class Mson implements Serializable } parts.add(part); } + return Mson.mson(parts); } @@ -1144,7 +1145,10 @@ public class Mson implements Serializable if (msons.size() == 1) parts.add(msons.get(0)); if (suffix != null) parts.add(suffix); - ret.add(implode(parts, SPACE)); + if ( ! parts.isEmpty()) + { + ret.add(implode(parts, SPACE)); + } if (msons.size() != 1) {