Create getShowLines utility methods in Property.
This commit is contained in:
parent
83920b7f45
commit
91a268e67e
@ -187,8 +187,7 @@ public class Parameter<T>
|
||||
|
||||
public static Parameter<Integer> getPage()
|
||||
{
|
||||
// We can't use a singletone, because people might
|
||||
// want to set a description.
|
||||
// We can't use a singleton because people might want to set a description.
|
||||
return new Parameter<Integer>(1, TypeInteger.get(), "page", "1");
|
||||
}
|
||||
|
||||
|
@ -146,11 +146,6 @@ public abstract class Property<O, V> implements Named
|
||||
return this.getValueType().createEditCommand(settings, this);
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return ChatColor.AQUA.toString() + this.getName();
|
||||
}
|
||||
|
||||
public String getInheritedVisual(O object, O source, V value, CommandSender sender)
|
||||
{
|
||||
String string = this.getValueType().getVisual(value, sender);
|
||||
@ -181,4 +176,34 @@ public abstract class Property<O, V> implements Named
|
||||
return this.getInheritedVisual(object, source, value, sender);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// VISUAL
|
||||
// -------------------------------------------- //
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return ChatColor.AQUA.toString() + this.getName();
|
||||
}
|
||||
|
||||
public List<String> getShowLines(O object, CommandSender sender)
|
||||
{
|
||||
String ret = Txt.parse("<aqua>%s<silver>: <pink>%s", this.getDisplayName(), this.getInheritedVisual(object, sender));
|
||||
return new MassiveList<String>(Txt.PATTERN_NEWLINE.split(ret));
|
||||
}
|
||||
|
||||
public static <O> List<String> getShowLines(O object, CommandSender sender, Collection<? extends Property<O, ?>> properties)
|
||||
{
|
||||
// Create
|
||||
List<String> ret = new MassiveList<String>();
|
||||
|
||||
// Fill
|
||||
for (Property<O, ?> property : properties)
|
||||
{
|
||||
ret.addAll(property.getShowLines(object, sender));
|
||||
}
|
||||
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user