Search in sources :

Example 31 with Pattern

use of org.bukkit.block.banner.Pattern in project Glowstone by GlowstoneMC.

the class GlowMetaBanner method serialize.

@Override
@NotNull
public Map<String, Object> serialize() {
    Map<String, Object> result = super.serialize();
    result.put("meta-type", "BANNER");
    List<Map<String, String>> patternsList = new ArrayList<>();
    for (Pattern pattern : patterns) {
        patternsList.add(ImmutableMap.of(pattern.getPattern().toString(), pattern.getColor().toString()));
    }
    result.put("pattern", patternsList);
    if (baseColor != null) {
        result.put("baseColor", baseColor);
    }
    return result;
}
Also used : Pattern(org.bukkit.block.banner.Pattern) ArrayList(java.util.ArrayList) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Pattern (org.bukkit.block.banner.Pattern)31 ArrayList (java.util.ArrayList)17 DyeColor (org.bukkit.DyeColor)9 HashMap (java.util.HashMap)6 BannerMeta (org.bukkit.inventory.meta.BannerMeta)6 PatternType (org.bukkit.block.banner.PatternType)5 CompoundTag (net.aufdemrand.denizen.nms.util.jnbt.CompoundTag)4 ListTag (net.aufdemrand.denizen.nms.util.jnbt.ListTag)4 CompoundTag (net.glowstone.util.nbt.CompoundTag)4 BookMeta (org.bukkit.inventory.meta.BookMeta)4 EnchantmentStorageMeta (org.bukkit.inventory.meta.EnchantmentStorageMeta)4 LeatherArmorMeta (org.bukkit.inventory.meta.LeatherArmorMeta)4 PotionMeta (org.bukkit.inventory.meta.PotionMeta)4 SkullMeta (org.bukkit.inventory.meta.SkullMeta)4 CompoundTag (com.denizenscript.denizen.nms.util.jnbt.CompoundTag)3 JNBTListTag (com.denizenscript.denizen.nms.util.jnbt.JNBTListTag)3 MCPattern (com.laytonsmith.abstraction.MCPattern)3 Map (java.util.Map)3 Banner (org.bukkit.block.Banner)3 Enchantment (org.bukkit.enchantments.Enchantment)3