Fix Inner --> Inner chain in Type Container and support Mson item visuals.
This commit is contained in:
parent
0399041b76
commit
f2648656aa
@ -26,6 +26,7 @@ import com.massivecraft.massivecore.comparator.ComparatorHashCode;
|
|||||||
import com.massivecraft.massivecore.mson.Mson;
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
import com.massivecraft.massivecore.store.SenderEntity;
|
import com.massivecraft.massivecore.store.SenderEntity;
|
||||||
import com.massivecraft.massivecore.util.ContainerUtil;
|
import com.massivecraft.massivecore.util.ContainerUtil;
|
||||||
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.util.ReflectionUtil;
|
import com.massivecraft.massivecore.util.ReflectionUtil;
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
@ -141,7 +142,9 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
@Override
|
@Override
|
||||||
public Mson getVisualMsonInner(T value, CommandSender sender)
|
public Mson getVisualMsonInner(T value, CommandSender sender)
|
||||||
{
|
{
|
||||||
return Mson.fromParsedMessage(this.getVisualInner(value, sender));
|
String visualInner = this.getVisualInner(value, sender);
|
||||||
|
if (visualInner == null) MUtil.stackTraceDebug("visualInner null for + " + value);
|
||||||
|
return Mson.fromParsedMessage(visualInner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.massivecraft.massivecore.MassiveException;
|
import com.massivecraft.massivecore.MassiveException;
|
||||||
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
public class TypeItemStack extends TypeAbstract<ItemStack>
|
public class TypeItemStack extends TypeAbstract<ItemStack>
|
||||||
{
|
{
|
||||||
@ -22,10 +24,9 @@ public class TypeItemStack extends TypeAbstract<ItemStack>
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVisualInner(ItemStack value, CommandSender sender)
|
public Mson getVisualMsonInner(ItemStack value, CommandSender sender)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
return Txt.createItemMson(value);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,7 +68,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
Mson part = Mson.mson(
|
Mson part = Mson.mson(
|
||||||
Mson.mson(String.valueOf(index)).color(ChatColor.WHITE),
|
Mson.mson(String.valueOf(index)).color(ChatColor.WHITE),
|
||||||
" ",
|
" ",
|
||||||
innerType.getVisualMsonInner(element, sender)
|
innerType.getVisualMson(element, sender)
|
||||||
);
|
);
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
for (E element : elements)
|
for (E element : elements)
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
String part = Txt.parse("<white>%d <yellow>%s", index, innerType.getVisualInner(element, sender));
|
String part = Txt.parse("<white>%d <yellow>%s", index, innerType.getVisual(element, sender));
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
Type<E> innerType = this.getInnerType();
|
Type<E> innerType = this.getInnerType();
|
||||||
for (E element : elements)
|
for (E element : elements)
|
||||||
{
|
{
|
||||||
String part = innerType.getNameInner(element);
|
String part = innerType.getName(element);
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
List<E> elements = this.getContainerElementsOrdered(container);
|
List<E> elements = this.getContainerElementsOrdered(container);
|
||||||
for (E element : elements)
|
for (E element : elements)
|
||||||
{
|
{
|
||||||
String part = innerType.getIdInner(element);
|
String part = innerType.getId(element);
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.massivecore.command.type.container;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
|
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
|
||||||
@ -10,7 +9,6 @@ import com.massivecraft.massivecore.command.editor.CommandEditItemStacks;
|
|||||||
import com.massivecraft.massivecore.command.editor.EditSettings;
|
import com.massivecraft.massivecore.command.editor.EditSettings;
|
||||||
import com.massivecraft.massivecore.command.editor.Property;
|
import com.massivecraft.massivecore.command.editor.Property;
|
||||||
import com.massivecraft.massivecore.command.type.TypeItemStack;
|
import com.massivecraft.massivecore.command.type.TypeItemStack;
|
||||||
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
|
||||||
|
|
||||||
public class TypeItemStacks extends TypeList<ItemStack>
|
public class TypeItemStacks extends TypeList<ItemStack>
|
||||||
{
|
{
|
||||||
@ -29,18 +27,6 @@ public class TypeItemStacks extends TypeList<ItemStack>
|
|||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVisualInner(List<ItemStack> value, CommandSender sender)
|
|
||||||
{
|
|
||||||
// Empty
|
|
||||||
if (value.isEmpty()) return EMPTY;
|
|
||||||
|
|
||||||
// Integer Size
|
|
||||||
return TypeInteger.get().getVisual(value.size(), sender);
|
|
||||||
|
|
||||||
// TODO: Improve
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <O> CommandEditAbstract<O, List<ItemStack>> createEditCommand(EditSettings<O> settings, Property<O, List<ItemStack>> property)
|
public <O> CommandEditAbstract<O, List<ItemStack>> createEditCommand(EditSettings<O> settings, Property<O, List<ItemStack>> property)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user