0.5h Hopefully show inheritance properly

This commit is contained in:
BuildTools 2016-05-15 17:28:01 +02:00 committed by Olof Larsson
parent eee611bfd6
commit b0558d310f
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -173,25 +173,8 @@ public abstract class Property<O, V> implements Named
public Mson getInheritedVisual(O object, O source, V value, CommandSender sender) public Mson getInheritedVisual(O object, O source, V value, CommandSender sender)
{ {
Mson mson = this.getValueType().getVisualMson(value, sender); Mson mson = this.getValueType().getVisualMson(value, sender);
/*if (string == null) return Mson.prepondfix(null, mson, this.getInheritanceSuffix(object, source));
{
System.out.println("value type " + this.getValueType());
System.out.println("value type name" + this.getValueType().getTypeName());
System.out.println("object " + object);
System.out.println("source " + source);
System.out.println("value " + value);
System.out.println("sender " + sender);
}*/
Mson suffix = null;
if (source != null && ! source.equals(object))
{
suffix = Mson.parse("<silver>[%s<silver>]").replaceAll("%s", this.getObjectType().getVisualMson(source));
} }
return Mson.prepondfix(null, mson, suffix);
}
public Mson getInheritedVisual(O object, CommandSender sender) public Mson getInheritedVisual(O object, CommandSender sender)
{ {
Entry<O, V> inherited = this.getInheritedEntry(object); Entry<O, V> inherited = this.getInheritedEntry(object);
@ -200,6 +183,21 @@ public abstract class Property<O, V> implements Named
return this.getInheritedVisual(object, source, value, sender); return this.getInheritedVisual(object, source, value, sender);
} }
public Mson getInheritanceSuffix(O object, O source)
{
Mson ret = null;
if (source != null && ! source.equals(object))
{
ret = Mson.parse("<silver>[%s<silver>]").replaceAll("%s", this.getObjectType().getVisualMson(source));
}
return ret;
}
public Mson getInheritanceSuffix(O object)
{
return this.getInheritanceSuffix(object, this.getInheritedObject(object));
}
// -------------------------------------------- // // -------------------------------------------- //
// VISUAL // VISUAL
// -------------------------------------------- // // -------------------------------------------- //
@ -220,7 +218,7 @@ public abstract class Property<O, V> implements Named
this.getDisplayNameMson(), this.getDisplayNameMson(),
Mson.mson(":").color(ChatColor.GRAY) Mson.mson(":").color(ChatColor.GRAY)
); );
List<Mson> ret = Mson.prepondfix(prefix, this.getValueType().getShow(this.getInheritedValue(object), sender), null); List<Mson> ret = Mson.prepondfix(prefix, this.getValueType().getShow(this.getInheritedValue(object), sender), this.getInheritanceSuffix(object));
for (ListIterator<Mson> it = ret.listIterator(1); it.hasNext();) for (ListIterator<Mson> it = ret.listIterator(1); it.hasNext();)
{ {