Package org.bukkit

Examples of org.bukkit.Color


          }
        }
      }
      if (config.contains(prefix + "armorcolor")) {
        int rgb = config.getInt(prefix + "armorcolor");
        Color clr = Color.fromRGB(rgb);
        LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
        meta.setColor(clr);
        stack.setItemMeta(meta);
      }
      if (config.contains(prefix + "name")) {
View Full Code Here


        }
        if (effects != null) {
            for (FireworkEffect effect: effects) {
                if (effect == null)
                    continue;
                Color ColOne = effect.getColors() != null && effect.getColors().size() > 0 ? effect.getColors().get(0): Color.BLUE;
                Color ColTwo = effect.getFadeColors() != null && effect.getFadeColors().size() > 0 ? effect.getFadeColors().get(0): ColOne;
                list.add(effect.hasTrail() + "," + effect.hasFlicker() + "," + effect.getType().name() + "," +
                        ColOne.getRed() + "," + ColOne.getGreen() + "," + ColOne.getBlue() + "," +
                        ColTwo.getRed() + "," + ColTwo.getGreen() + "," + ColTwo.getBlue());
            }
        }
        return list;
    }
View Full Code Here

                                type = FireworkEffect.Type.BALL;

                            //Colour Data (3)
                            errorLocation = "Colour";
                            String[] rgb = RegexUtil.COMMA_PATTERN.split(data[3]);
                            Color colour = org.bukkit.Color.fromRGB(Integer.parseInt(rgb[0]),
                                    Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));

                            //Colour Data (4)
                            errorLocation = "Fade";
                            rgb = RegexUtil.COMMA_PATTERN.split(data[4]);
                            Color fade = org.bukkit.Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
                                    Integer.parseInt(rgb[2]));

                            boolean flicker = false;
                            boolean trail = false;
View Full Code Here

                                type = FireworkEffect.Type.BALL;
                            builder.with(type);
                        } else if (args[0].equalsIgnoreCase("color")) {

                            String[] rgb = RegexUtil.COMMA_PATTERN.split(args[1]);
                            Color color = org.bukkit.Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));
                            builder.withColor(color);
                        } else if (args[0].equalsIgnoreCase("fade")) {

                            String[] rgb = RegexUtil.COMMA_PATTERN.split(args[1]);
                            Color fade = org.bukkit.Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));
                            builder.withFade(fade);
                        } else if (args[0].equalsIgnoreCase("flicker") || args[0].equalsIgnoreCase("twinkle")) {

                            builder.flicker(true);
                        } else if (args[0].equalsIgnoreCase("trail")) {
View Full Code Here

  public static void transferLeatherArmorMeta(LeatherArmorMeta meta, JsonObject json, boolean meta2json)
  {
    if (meta2json)
    {
      Color color = meta.getColor();
     
      if (Bukkit.getItemFactory().getDefaultLeatherColor().equals(color)) return;

      json.addProperty(LEATHER_ARMOR_COLOR, color.asRGB());
    }
    else
    {
      JsonElement element = json.get(LEATHER_ARMOR_COLOR);
      if (element == null) return;
View Full Code Here

            SkullMeta skullmeta = (SkullMeta) meta;
            if(((SkullMeta) meta).hasOwner()) {
                smeta.append("O" + skullmeta.getOwner() + "#");
            }
        } else if(meta instanceof LeatherArmorMeta) {
            Color color = ((LeatherArmorMeta) meta).getColor();
            smeta.append("C" + String.valueOf(color.asRGB()) + "#");
        } else if(meta instanceof PotionMeta) {
            if(((PotionMeta) meta).hasCustomEffects()) {
                List<PotionEffect> effects = ((PotionMeta) meta).getCustomEffects();
                for(PotionEffect effect : effects) {
                    smeta.append("P" + effect.getType().getName() + "+" + effect.getAmplifier() + "+" + effect.getDuration() + "#");
                }
            }
        }else if(meta instanceof EnchantmentStorageMeta) {
            EnchantmentStorageMeta emeta = (EnchantmentStorageMeta) meta;
            if(emeta.hasStoredEnchants()) {
                Set<Entry<Enchantment,Integer>> enchants = emeta.getStoredEnchants().entrySet();
                for(Entry<Enchantment,Integer> enchant : enchants) {
                    smeta.append("E" + enchant.getKey().getName() + "+" + enchant.getValue().toString() + "#");
                }
            }
        }else if(meta instanceof FireworkMeta) {
            List<FireworkEffect> effects = ((FireworkMeta) meta).getEffects();
            ((FireworkMeta) meta).getPower();
            for(FireworkEffect effect : effects) {
                List<Color> colors = effect.getColors();
                List<Color> fadecolors = effect.getFadeColors();
                StringBuilder colorstring = new StringBuilder();
                for(Color color : colors) {
                    if(colorstring.length() > 0) {
                        colorstring.append("-");
                    }
                    colorstring.append(Integer.toString(color.asRGB()));
                }
                StringBuilder fadecolorstring = new StringBuilder();
                for(Color color : fadecolors) {
                    if(fadecolorstring.length() > 0) {
                        fadecolorstring.append("-");
                    }
                    fadecolorstring.append(Integer.toString(color.asRGB()));
                }
                smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
                        effect.hasFlicker() + "+" + effect.hasTrail() + "#");
            }
            smeta.append("G" + Integer.toString(((FireworkMeta) meta).getPower()) + "#");
        }else if(meta instanceof FireworkEffectMeta) {
            FireworkEffect effect = ((FireworkEffectMeta) meta).getEffect();
            if(effect != null) {
                List<Color> colors = effect.getColors();
                List<Color> fadecolors = effect.getFadeColors();
                StringBuilder colorstring = new StringBuilder();
                for(Color color : colors) {
                    if(colorstring.length() > 0) {
                        colorstring.append("-");
                    }
                    colorstring.append(Integer.toString(color.asRGB()));
                }
                StringBuilder fadecolorstring = new StringBuilder();
                for(Color color : fadecolors) {
                    if(fadecolorstring.length() > 0) {
                        fadecolorstring.append("-");
                    }
                    fadecolorstring.append(Integer.toString(color.asRGB()));
                }
                smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
                        effect.hasFlicker() + "+" + effect.hasTrail() + "#");
            }
        }
View Full Code Here

        try { damage = Integer.parseInt(gear.getAttributeValue("damage")); } catch (Exception ignored) {  }

        // get item stack locally so we can inspect it a bit first
        ItemStack item = new ItemStack(type, count, (short) damage);

        Color color = null;
        if (item.getItemMeta() instanceof LeatherArmorMeta)
        {
          // add this to the list of items that need to be team colored
          if (gear.getChild("teamcolor") != null)
            this.teamColors.add(item);
View Full Code Here

TOP

Related Classes of org.bukkit.Color

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.