From 351edbf4e5dc679dfe65258c6919e9a2a75f7ae8 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 2 Dec 2014 15:29:04 +0100 Subject: [PATCH] Fix CraftMetaBanner serialization. --- .../bukkit/craftbukkit/inventory/CraftMetaBanner.java | 9 +++++++-- .../org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java index d61615bfad..713d70cd1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java @@ -145,8 +145,13 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta { ImmutableMap.Builder serialize(ImmutableMap.Builder builder) { super.serialize(builder); - builder.put(BASE.BUKKIT, base); - builder.put(PATTERNS.BUKKIT, ImmutableList.copyOf(patterns)); + if(base != null){ + builder.put(BASE.BUKKIT, base); + } + + if(!patterns.isEmpty()){ + builder.put(PATTERNS.BUKKIT, ImmutableList.copyOf(patterns)); + } return builder; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index c9738c4f09..1f7b5239aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -96,6 +96,7 @@ class CraftMetaItem implements ItemMeta, Repairable { static { classMap = ImmutableMap., String>builder() + .put(CraftMetaBanner.class, "BANNER") .put(CraftMetaBook.class, "BOOK") .put(CraftMetaSkull.class, "SKULL") .put(CraftMetaLeatherArmor.class, "LEATHER_ARMOR")