SPIGOT-1068: Limit the number of patterns on banners

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2015-07-23 20:50:53 +01:00
parent 059a14a3a5
commit 9a15d77433
2 changed files with 28 additions and 2 deletions

View File

@@ -50,8 +50,8 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
if (entityTag.hasKey(PATTERNS.NBT)) {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, 10);
for (int i = 0; i < patterns.size(); i++) {
NBTTagCompound p = (NBTTagCompound) patterns.get(i);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
NBTTagCompound p = patterns.get(i);
this.patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
}
}