1.0h Pages in editor show
This commit is contained in:
parent
0a297211bf
commit
9c55b4836e
@ -16,6 +16,7 @@ import com.massivecraft.massivecore.command.type.Type;
|
|||||||
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
||||||
import com.massivecraft.massivecore.mson.Mson;
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
import com.massivecraft.massivecore.util.PermUtil;
|
import com.massivecraft.massivecore.util.PermUtil;
|
||||||
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
public class CommandEditAbstract<O, V> extends MassiveCommand
|
public class CommandEditAbstract<O, V> extends MassiveCommand
|
||||||
{
|
{
|
||||||
@ -297,18 +298,36 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
|
|||||||
return alias;
|
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();
|
Mson descValue = this.getInheritedVisual();
|
||||||
message(mson(
|
|
||||||
descProperty,
|
// For things with line breaks.
|
||||||
" for ",
|
if (descValue.contains("\n"))
|
||||||
descObject,
|
{
|
||||||
": ",
|
Mson title = mson(
|
||||||
descValue
|
this.getProperty().getDisplayNameMson(),
|
||||||
|
" for ",
|
||||||
|
this.getObjectVisual()
|
||||||
|
);
|
||||||
|
List<Mson> 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));
|
).color(ChatColor.GRAY));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requireNullable() throws MassiveException
|
public void requireNullable() throws MassiveException
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.massivecore.command.editor;
|
package com.massivecraft.massivecore.command.editor;
|
||||||
|
|
||||||
import com.massivecraft.massivecore.MassiveException;
|
import com.massivecraft.massivecore.MassiveException;
|
||||||
|
import com.massivecraft.massivecore.command.Parameter;
|
||||||
|
|
||||||
public class CommandEditShow<O, V> extends CommandEditAbstract<O, V>
|
public class CommandEditShow<O, V> extends CommandEditAbstract<O, V>
|
||||||
{
|
{
|
||||||
@ -17,6 +18,9 @@ public class CommandEditShow<O, V> extends CommandEditAbstract<O, V>
|
|||||||
String alias = this.createCommandAlias();
|
String alias = this.createCommandAlias();
|
||||||
this.setAliases(alias);
|
this.setAliases(alias);
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
this.addParameter(Parameter.getPage());
|
||||||
|
|
||||||
// Desc
|
// Desc
|
||||||
this.setDesc(alias + " " + this.getPropertyName());
|
this.setDesc(alias + " " + this.getPropertyName());
|
||||||
}
|
}
|
||||||
@ -28,7 +32,8 @@ public class CommandEditShow<O, V> extends CommandEditAbstract<O, V>
|
|||||||
@Override
|
@Override
|
||||||
public void perform() throws MassiveException
|
public void perform() throws MassiveException
|
||||||
{
|
{
|
||||||
this.show(sender);
|
int page = this.readArg();
|
||||||
|
this.show(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class CommandEditSimple<O, V> extends CommandEditAbstract<O, V>
|
|||||||
// Show
|
// Show
|
||||||
if ( ! this.argIsSet(0))
|
if ( ! this.argIsSet(0))
|
||||||
{
|
{
|
||||||
this.show(sender);
|
this.show(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
index++;
|
index++;
|
||||||
Mson part = Mson.mson(
|
Mson part = Mson.mson(
|
||||||
Mson.mson(String.valueOf(index)).color(ChatColor.WHITE),
|
Mson.mson(String.valueOf(index)).color(ChatColor.WHITE),
|
||||||
" ",
|
Mson.SPACE,
|
||||||
innerType.getVisualMson(element, sender)
|
innerType.getVisualMson(element, sender)
|
||||||
);
|
);
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
|
@ -1057,6 +1057,7 @@ public class Mson implements Serializable
|
|||||||
}
|
}
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Mson.mson(parts);
|
return Mson.mson(parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,7 +1145,10 @@ public class Mson implements Serializable
|
|||||||
if (msons.size() == 1) parts.add(msons.get(0));
|
if (msons.size() == 1) parts.add(msons.get(0));
|
||||||
if (suffix != null) parts.add(suffix);
|
if (suffix != null) parts.add(suffix);
|
||||||
|
|
||||||
ret.add(implode(parts, SPACE));
|
if ( ! parts.isEmpty())
|
||||||
|
{
|
||||||
|
ret.add(implode(parts, SPACE));
|
||||||
|
}
|
||||||
|
|
||||||
if (msons.size() != 1)
|
if (msons.size() != 1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user