Java 类org.bukkit.block.banner.PatternType 实例源码

项目:uppercore    文件:BannerCustomItem.java   
@SuppressWarnings("unchecked")
public BannerCustomItem(Material material, Config config, PlaceholderRegistry placeholders) {
    super(material, config, placeholders);
    this.baseColor = config.getDye("baseColor");
    Collection<Map<String, Object>> rawPatterns = (Collection<Map<String, Object>>) config.getCollection("patterns");
    patterns = new ArrayList<>();
    if(rawPatterns != null) {
        for (Map<String, Object> p : rawPatterns) {
            Config sub = Config.wrap(p);
            DyeColor color = sub.getDyeRequired("color");
            PatternType type = PatternType.getByIdentifier(sub.getStringRequired("pattern"));
            if (type == null) {
                Uppercore.logger().severe("Cannot find pattern identifier \"" + p.get("pattern") + "\"");
                type = PatternType.BASE;
            }
            patterns.add(new Pattern(color, type));
        }
    }
}
项目:Phantom    文件:Flag.java   
/**
 * Create a flag representing the given banner block
 * 
 * @param block
 *            the block. Does nothing if it is not a banner
 */
public Flag(Block block)
{
    this(DyeColor.WHITE);

    if(block.getState() instanceof Banner)
    {
        Banner bm = ((Banner) block.getState());
        baseColor = bm.getBaseColor();

        for(int i = 0; i < bm.numberOfPatterns(); i++)
        {
            if(bm.getPattern(i).getPattern().equals(PatternType.BASE))
            {
                continue;
            }

            addLayer(new FlagLayer(bm.getPattern(i)));
        }
    }
}
项目:Phantom    文件:Flag.java   
/**
 * Create a flag representing a banner item's layers. Does nothing if it is not
 * a banner
 * 
 * @param item
 *            the item. Does nothing if it isnt a banner
 */
@SuppressWarnings("deprecation")
public Flag(ItemStack item)
{
    this(DyeColor.WHITE);

    if(item.getType().equals(Material.BANNER))
    {
        BannerMeta bm = ((BannerMeta) item.getItemMeta());
        baseColor = bm.getBaseColor();

        for(int i = 0; i < bm.numberOfPatterns(); i++)
        {
            if(bm.getPattern(i).getPattern().equals(PatternType.BASE))
            {
                continue;
            }

            addLayer(new FlagLayer(bm.getPattern(i)));
        }
    }
}
项目:NexusInventory    文件:BannerSerialization.java   
/**
 * A method to deserialize a BannerMeta object from a JSONObject. This method assumes that the JSONArrays containing
 * the colors and pattern types are the same length.
 *
 * @param json The JSONObject of the BannerMeta to deserialize
 * @return The BannerMeta or null if an exception occurs
 */
public static BannerMeta getBannerMeta(JSONObject json) {
    try {
        BannerMeta dummy = (BannerMeta) new ItemStack(Material.BANNER).getItemMeta();
        if (json.has("base-color"))
            dummy.setBaseColor(DyeColor.getByDyeData(Byte.parseByte("" + json.get("base-color"))));

        JSONArray colors = json.getJSONArray("colors");
        JSONArray patternTypes = json.getJSONArray("pattern-types");
        for (int i = 0; i < colors.length(); i++) {
            dummy.addPattern(new Pattern(DyeColor.getByDyeData(Integer.valueOf((int) colors.get(i)).byteValue()),
                    PatternType.getByIdentifier(patternTypes.getString(i))));
        }

        return dummy;
    } catch (JSONException ex) {
        ex.printStackTrace();
        return null;
    }
}
项目:Craftbukkit    文件:CraftMetaBanner.java   
CraftMetaBanner(NBTTagCompound tag) {
    super(tag);

    if (!tag.hasKey("BlockEntityTag")) {
        return;
    }

    NBTTagCompound entityTag = tag.getCompound("BlockEntityTag");

    base = entityTag.hasKey(BASE.NBT) ? DyeColor.getByDyeData((byte) entityTag.getInt(BASE.NBT)) : null;

    if (entityTag.hasKey(PATTERNS.NBT)) {
        NBTTagList patterns = entityTag.getList(PATTERNS.NBT, 10);
        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))));
        }
    }
}
项目:SpigotSource    文件:CraftMetaBanner.java   
CraftMetaBanner(NBTTagCompound tag) {
    super(tag);

    if (!tag.hasKey("BlockEntityTag")) {
        return;
    }

    NBTTagCompound entityTag = tag.getCompound("BlockEntityTag");

    base = entityTag.hasKey(BASE.NBT) ? DyeColor.getByDyeData((byte) entityTag.getInt(BASE.NBT)) : null;

    if (entityTag.hasKey(PATTERNS.NBT)) {
        NBTTagList patterns = entityTag.getList(PATTERNS.NBT, 10);
        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))));
        }
    }
}
项目:QuarSK    文件:ExprRandomBanner.java   
@NotNull
@Override
protected ItemStack[] get(Event event) {
    ItemStack banner = new ItemStack(type);
    BannerMeta meta = (BannerMeta) banner.getItemMeta();
    meta.setBaseColor(CollectionUtils.getRandom(DyeColor.values()));
    for (int i = 0; i < new Random().nextInt(7); i++)
        meta.addPattern(new Pattern(CollectionUtils.getRandom(DyeColor.values()),
            CollectionUtils.getRandom(PatternType.values())
        ));
    banner.setItemMeta(meta);
    return new ItemStack[]{banner};
}
项目:QuarSK    文件:ExprCustomBannerLayer.java   
@Nullable
@Override
protected Pattern[] get(Event e) {
    Color c = color.getSingle(e);
    PatternType p = pattern.getSingle(e);
    if (c == null || p == null) {
        return null;
    }
    return new Pattern[]{new Pattern(c.getWoolColor(), p)};
}
项目:QuarSK    文件:BannerUtils.java   
public static char patternTypeToMnc(@NotNull PatternType patternType) {
    for (char c : StringUtils.alphabetLetters()) {
        if (patternTypeFromMnc(c) == patternType) {
            return c;
        }
    }
    return 0;
}
项目:Leveled-Storage    文件:PatternStorage.java   
@Override
public void read(DataInputStream input) throws IOException {
    DyeColor color = DyeColor.getByDyeData(input.readByte());
    PatternType patternType = PatternType.getByIdentifier(input.readUTF());

    setValue(new Pattern(color, patternType));
}
项目:VanillaPlus    文件:MinecraftUtils.java   
public static Pattern craftPanner(ConfigurationSection section) {
    if(section == null) {
        Error.INVALID.add();
        return null;
    } else {
        DyeColor dyeColor = dyeFrom(section.getString("COLOR"), true);
        PatternType patt = Utils.matchEnum(PatternType.values(), section.getString("TYPE"), true);
        return new Pattern(dyeColor, patt);
    }
}
项目:BannerMaker    文件:IOUtil.java   
private static ItemStack loadBanner(Player player, String key) {
    //設定檔
    String fileName = getFileName(player);
    FileConfiguration config = KConfigManager.get(fileName);
    //檢查是否為物品
    ItemStack banner = null;
    //檢查是否為正確格式
    if (config.isInt(key + ".color") && (!config.contains(key + ".patterns") || config.isList(key + ".patterns"))) {
        //嘗試以新格式讀取
        try {
            //建立旗幟
            banner = new ItemStack(Material.BANNER, 1, (short) config.getInt(key + ".color"));
            BannerMeta bm = (BannerMeta) banner.getItemMeta();
            //新增Patterns
            if (config.contains(key + ".patterns")) {
                List<String> patternsList = config.getStringList(key + ".patterns");
                for (String str : patternsList) {
                    String strPattern = str.split(":")[0];
                    String strColor = str.split(":")[1];
                    Pattern pattern = new Pattern(DyeColor.valueOf(strColor), PatternType.getByIdentifier(strPattern));
                    bm.addPattern(pattern);
                }
                banner.setItemMeta(bm);
            }
            //將key藏於Lore
            bm.setLore(Collections.singletonList(HiddenStringUtil.encodeString(key)));
            banner.setItemMeta(bm);
        } catch (Exception e) {
            banner = null;
        }
    }
    //只處理旗幟
    if (!BannerUtil.isBanner(banner)) {
        return null;
    }
    return banner;
}
项目:PerWorldInventory    文件:DeprecatedMethodUtil.java   
/**
 * A method to deserialize a BannerMeta object from a JSONObject. This method assumes that the JSONArrays containing
 * the colors and pattern types are the same length.
 *
 * @param json The JSONObject of the BannerMeta to deserialize
 * @return The BannerMeta
 */
public static BannerMeta getBannerMeta(JsonObject json) {
    BannerMeta dummy = (BannerMeta) new ItemStack(Material.BANNER).getItemMeta();
    if (json.has("base-color"))
        dummy.setBaseColor(DyeColor.getByDyeData(Byte.parseByte("" + json.get("base-color"))));

    JsonArray colors = json.getAsJsonArray("colors");
    JsonArray patternTypes = json.getAsJsonArray("pattern-types");
    for (int i = 0; i < colors.size() - 1; i++) {
        dummy.addPattern(new Pattern(DyeColor.getByDyeData(Integer.valueOf(colors.get(i).getAsInt()).byteValue()),
                PatternType.getByIdentifier(patternTypes.get(i).getAsString())));
    }

    return dummy;
}
项目:SupaCommons    文件:MNCSBannerGenerator.java   
/**
 * Parses a MinersNeedCoolShoes Banner generator generated code into a Bukkit ItemStack of
 * {@link Material#BANNER}. Code must have an even amount of characters, with the first of the
 * pair being the color, and the second being the pattern. See {@link MNCSBannerGenerator} for
 * a table of those.
 *
 * @param code code to parse
 *
 * @return banner itemstack
 */
public static ItemStack parseCode(@Nonnull String code) {
  StringUtils.checkNotNullOrEmpty(code, "code");
  Preconditions.checkArgument(code.length() % 2 == 0, "code must be even characters");
  ItemBuilder builder = ItemBuilder.builder(Material.BANNER);
  char[] chars = code.toCharArray();
  for (int i = 0; i < chars.length; i++) {
    DyeColor dyeColor = COLOR_CODES.get(chars[i]);
    Preconditions.checkNotNull(dyeColor, "'" + chars[i] + " is not a valid color.");
    PatternType patternType = PATTERN_CODES.get(chars[++i]);
    Preconditions.checkNotNull(patternType, "'" + chars[i] + " is not a valid pattern.");
    builder.bannerAdd(new org.bukkit.block.banner.Pattern(dyeColor, patternType));
  }
  return builder.build();
}
项目:Craftbukkit    文件:CraftBanner.java   
public CraftBanner(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    banner = (TileEntityBanner) world.getTileEntityAt(getX(), getY(), getZ());

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
        for (int i = 0; i < banner.patterns.size(); i++) {
            NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
            patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt("Color")), PatternType.getByIdentifier(p.getString("Pattern"))));
        }
    }
}
项目:Craftbukkit    文件:CraftBanner.java   
public CraftBanner(final Material material, final TileEntityBanner te) {
    super(material);
    banner = te;

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
        for (int i = 0; i < banner.patterns.size(); i++) {
            NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
            patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt("Color")), PatternType.getByIdentifier(p.getString("Pattern"))));
        }
    }
}
项目:NovaGuilds    文件:BannerUtils.java   
/**
 * Gets random banner meta
 *
 * @return banner meta
 */
public static BannerMeta getRandomMeta() {
    if(ConfigManager.getServerVersion().isOlderThan(ConfigManager.ServerVersion.MINECRAFT_1_8_R2)) {
        return null;
    }

    BannerMeta meta = (BannerMeta) Bukkit.getItemFactory().getItemMeta(Material.BANNER);
    meta.setBaseColor(randomDyeColor());

    for(int i = NumberUtils.randInt(0, PatternType.values().length) + 2; i > 0; i--) {
        meta.addPattern(new Pattern(randomDyeColor(), randomPatternType()));
    }

    return meta;
}
项目:PerWorldInventory    文件:DeprecatedMethodUtil.java   
/**
 * A method to deserialize a BannerMeta object from a JSONObject. This method assumes that the JSONArrays containing
 * the colors and pattern types are the same length.
 *
 * @param json The JSONObject of the BannerMeta to deserialize
 * @return The BannerMeta
 */
public static BannerMeta getBannerMeta(JsonObject json) {
    BannerMeta dummy = (BannerMeta) new ItemStack(Material.BANNER).getItemMeta();
    if (json.has("base-color"))
        dummy.setBaseColor(DyeColor.getByDyeData(Byte.parseByte("" + json.get("base-color"))));

    JsonArray colors = json.getAsJsonArray("colors");
    JsonArray patternTypes = json.getAsJsonArray("pattern-types");
    for (int i = 0; i < colors.size() - 1; i++) {
        dummy.addPattern(new Pattern(DyeColor.getByDyeData(Integer.valueOf(colors.get(i).getAsInt()).byteValue()),
                PatternType.getByIdentifier(patternTypes.get(i).getAsString())));
    }

    return dummy;
}
项目:SpigotSource    文件:CraftBanner.java   
public CraftBanner(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    banner = (TileEntityBanner) world.getTileEntityAt(getX(), getY(), getZ());

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
        for (int i = 0; i < banner.patterns.size(); i++) {
            NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
            patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt("Color")), PatternType.getByIdentifier(p.getString("Pattern"))));
        }
    }
}
项目:SpigotSource    文件:CraftBanner.java   
public CraftBanner(final Material material, final TileEntityBanner te) {
    super(material);
    banner = te;

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
        for (int i = 0; i < banner.patterns.size(); i++) {
            NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
            patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt("Color")), PatternType.getByIdentifier(p.getString("Pattern"))));
        }
    }
}
项目:QuarSK    文件:ExprCustomBannerLayer.java   
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    pattern = (Expression<PatternType>) expr[0];
    color = (Expression<Color>) expr[1];
    return true;
}
项目:GameBoxx    文件:BannerPatterns.java   
@Override
public void onLoad() {
    add(PatternType.BASE, "Base", "b", "None");
    add(PatternType.SQUARE_BOTTOM_LEFT, "Bottom Left Corner", "bl", "Bottom Left Square", "blc", "BLCorner", "BLSquare", "v<");
    add(PatternType.SQUARE_BOTTOM_RIGHT, "Bottom Right Corner", "br", "Bottom Right Square", "BRCorner", "BRSquare", "v>");
    add(PatternType.SQUARE_TOP_LEFT, "Top Left Corner", "tl", "top Left Square", "tlc", "TLCorner", "TLSquare", "^<");
    add(PatternType.SQUARE_TOP_RIGHT, "Top Right Corner", "tr", "Top right Square", "trc", "TRCorner", "TRSquare", "^>");
    add(PatternType.STRIPE_BOTTOM, "Bottom Stripe", "bs", "BStripe", "_");
    add(PatternType.STRIPE_TOP, "Top Stripe", "ts", "TStripe", "^_");
    add(PatternType.STRIPE_LEFT, "Left Stripe", "ls", "LStripe", "[");
    add(PatternType.STRIPE_RIGHT, "Right Stripe", "rs", "RStripe", "]");
    add(PatternType.STRIPE_CENTER, "Center Stripe", "cs", "CStripe", "Vertical Stripe", "VStripe", "|");
    add(PatternType.STRIPE_MIDDLE, "Middle Stripe", "ms", "MStripe", "Horizontal Stripe", "HStripe", "-");
    add(PatternType.STRIPE_DOWNRIGHT, "Down Right Stripe", "drs", "DRStripe", "Up Left Stripe", "ULStripe", "Backward Slash", "BSlash", "\\");
    add(PatternType.STRIPE_DOWNLEFT, "Down Left Stripe", "dls", "DLSTripe", "Up Right Stripe", "URStripe", "Slash", "Forward Slash", "FSlash", "/");
    add(PatternType.STRIPE_SMALL, "Small Stripes", "ss", "Stripes", "Vertical Stripes", "SStripes", "VStripes", "||");
    add(PatternType.CROSS, "Diagonal Cross", "cr", "Cross", "DCross", "X");
    add(PatternType.STRAIGHT_CROSS, "Square Cross", "sc", "Plus", "Add", "SCross", "Straight Cross", "SCross", "+");
    add(PatternType.TRIANGLE_BOTTOM, "Bottom Triangle", "bt", "BTriangle", "^");
    add(PatternType.TRIANGLE_TOP, "Top Triangle", "tt", "TTriangle", "V");
    add(PatternType.TRIANGLES_BOTTOM, "Bottom Triangle Sawtooth", "bts", "Bottom Triangles", "BTriangle Sawtooth", "BTriangle", "BTriangles", "M");
    add(PatternType.TRIANGLES_TOP, "Top Triangle Sawtooth", "tts", "Top Triangles", "TTriangle Sawtooth", "TTriangle", "TTriangles", "W");
    add(PatternType.DIAGONAL_LEFT, "Left Diagonal", "ld", "LDiagonal", "|/");
    add(PatternType.DIAGONAL_RIGHT, "Right Diagonal", "rd", "RDiagonal", "/|");
    add(PatternType.DIAGONAL_LEFT_MIRROR, "Left Upside-down Diagonal", "lud", "ULDiagonal", "MLDiagonal", "LUDiagonal", "LMDiagonal", "|\\");
    add(PatternType.DIAGONAL_RIGHT_MIRROR, "Right Upside-down Diagonal", "rud", "URDiagonal", "MRDiagonal", "RUDiagonal", "RMDiagonal", "\\|");
    add(PatternType.CIRCLE_MIDDLE, "Middle Circle", "mc", "Circle", "Round", "MCircle", "O", "0");
    add(PatternType.RHOMBUS_MIDDLE, "Middle Rhombus", "mr", "Rhombus", "MRhombus", "<>");
    add(PatternType.HALF_VERTICAL, "Vertical Half Left", "vh", "VHalf Left", "VHalfL", "Vertical Half", "VHalf", "#|");
    add(PatternType.HALF_HORIZONTAL, "Horizontal Half Top", "hh", "HHalf Top", "HHalfT", "Horizontal Half", "HHalf", "#^");
    add(PatternType.HALF_VERTICAL_MIRROR, "Vertical Half Right", "vhr", "VHalf Right", "VHalfR", "Vertical Half Inverted", "VHalf Inverted", "VHalfI", "|#");
    add(PatternType.HALF_HORIZONTAL_MIRROR, "Horizontal Half Bottom", "hhb", "HHalf Bottom", "HHalfB", "Horizontal Half Inverted", "HHalf Inverted", "HHalfI", "#v");
    add(PatternType.BORDER, "Border", "bo", "[]");
    add(PatternType.CURLY_BORDER, "Curly Border", "cbo", "CBorder", "{}");
    add(PatternType.CREEPER, "Creeper", "cre", ":[");
    add(PatternType.GRADIENT, "Gradient Down", "gra", "Grad Down", "GDown", "GradientD", "GradD", "Gradient", "Grad", "=v");
    add(PatternType.GRADIENT_UP, "Gradient Up", "gru", "Grad Up", "GUp", "GradientU", "GradU", "=^");
    add(PatternType.BRICKS, "Brick", "bri", "Bricks", "#");
    add(PatternType.SKULL, "Skull", "sku", "Wither", "Wither Skull", "WSkull", "#X");
    add(PatternType.FLOWER, "Flower", "flo", "Plant", "*");
    add(PatternType.MOJANG, "Mojang", "moj", "Logo", "@");
}
项目:GameBoxx    文件:BannerPatterns.java   
public static PatternType get(String string) {
    return instance()._get(string);
}
项目:GameBoxx    文件:BannerPatterns.java   
public static String getName(PatternType key) {
    return instance()._getName(key);
}
项目:GameBoxx    文件:BannerPatterns.java   
public static String getDisplayName(PatternType key) {
    return instance()._getDisplayName(key);
}
项目:GameBoxx    文件:BannerPatterns.java   
public static List<String> getAliases(PatternType key) {
    return instance()._getAliases(key);
}
项目:BannerMaker    文件:BannerUtil.java   
public static List<PatternType> getPatternTypeList() {
    List<PatternType> list = Arrays.asList(
        PatternType.BORDER,
        PatternType.BRICKS,
        PatternType.CIRCLE_MIDDLE,
        PatternType.CREEPER,
        PatternType.CROSS,
        PatternType.CURLY_BORDER,
        PatternType.DIAGONAL_LEFT,
        PatternType.DIAGONAL_LEFT_MIRROR,
        PatternType.DIAGONAL_RIGHT,
        PatternType.DIAGONAL_RIGHT_MIRROR,
        PatternType.FLOWER,
        PatternType.GRADIENT,
        PatternType.GRADIENT_UP,
        PatternType.HALF_HORIZONTAL,
        PatternType.HALF_HORIZONTAL_MIRROR,
        PatternType.HALF_VERTICAL,
        PatternType.HALF_VERTICAL_MIRROR,
        PatternType.MOJANG,
        PatternType.RHOMBUS_MIDDLE,
        PatternType.SKULL,
        PatternType.SQUARE_BOTTOM_LEFT,
        PatternType.SQUARE_BOTTOM_RIGHT,
        PatternType.SQUARE_TOP_LEFT,
        PatternType.SQUARE_TOP_RIGHT,
        PatternType.STRAIGHT_CROSS,
        PatternType.STRIPE_BOTTOM,
        PatternType.STRIPE_CENTER,
        PatternType.STRIPE_DOWNLEFT,
        PatternType.STRIPE_DOWNRIGHT,
        PatternType.STRIPE_LEFT,
        PatternType.STRIPE_MIDDLE,
        PatternType.STRIPE_RIGHT,
        PatternType.STRIPE_SMALL,
        PatternType.STRIPE_TOP,
        PatternType.TRIANGLE_BOTTOM,
        PatternType.TRIANGLE_TOP,
        PatternType.TRIANGLES_BOTTOM,
        PatternType.TRIANGLES_TOP
    );
    return list;
}
项目:NovaGuilds    文件:BannerMetaSerializerImpl.java   
@Override
public BannerMeta deserialize(String string) {
    BannerMeta meta = (BannerMeta) Bukkit.getItemFactory().getItemMeta(Material.BANNER);

    if(string == null || string.isEmpty()) {
        return meta;
    }

    String baseColorString;
    String patternsString;

    if(StringUtils.contains(string, ':')) {
        String[] baseSplit = StringUtils.split(string, ':');
        baseColorString = baseSplit[0];
        patternsString = baseSplit[1];
    }
    else {
        baseColorString = string;
        patternsString = "";
    }

    meta.setBaseColor(DyeColor.valueOf(baseColorString));

    if(!patternsString.isEmpty()) {
        String[] patternsSplit;

        if(StringUtils.contains(patternsString, '|')) {
            patternsSplit = StringUtils.split(patternsString, '|');
        }
        else {
            patternsSplit = new String[]{
                    patternsString
            };
        }

        for(String patternString : patternsSplit) {
            String[] patternSplit = StringUtils.split(patternString, '-');

            meta.addPattern(new Pattern(DyeColor.valueOf(patternSplit[0]), PatternType.getByIdentifier(patternSplit[1])));
        }
    }

    return meta;
}
项目:GameBoxx    文件:EItem.java   
/**
 * Add a {@link Pattern} on the banner item.
 * <p/>
 * Items: {@link Material#BANNER}
 *
 * @param type The {@link PatternType} to add on the banner.
 * @param color The {@link DyeColor} for the pattern.
 * @return this instance.
 */
public EItem addPattern(PatternType type, DyeColor color) {
    return addPattern(new Pattern(color, type));
}
项目:GameBoxx    文件:EItem.java   
/**
 * Set a {@link Pattern} on the banner item at the specified index.
 * <p/>
 * If the index is below 0 nothing will happen,
 * if it's too high the pattern will be added on the end instead.
 * <p/>
 * Items: {@link Material#BANNER}
 *
 * @param index The index to set the pattern at.
 * @param type The {@link PatternType} to set on the banner.
 * @param color The {@link DyeColor} for the pattern.
 * @return this instance.
 */
public EItem setPattern(Integer index, PatternType type, DyeColor color) {
    return setPattern(index, new Pattern(color, type));
}
项目:NovaGuilds    文件:BannerUtils.java   
/**
 * Gets random pattern type
 *
 * @return pattern type
 */
protected static PatternType randomPatternType() {
    return PatternType.values()[NumberUtils.randInt(0, PatternType.values().length - 1)];
}