當前位置: 首頁>>代碼示例>>Java>>正文


Java Color類代碼示例

本文整理匯總了Java中org.bukkit.Color的典型用法代碼示例。如果您正苦於以下問題:Java Color類的具體用法?Java Color怎麽用?Java Color使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Color類屬於org.bukkit包,在下文中一共展示了Color類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void read(DataInputStream input) throws IOException {
    FireworkEffect.Builder builder = FireworkEffect.builder();
    
    builder.flicker(input.readBoolean());
    builder.trail(input.readBoolean());
    
    int len = input.readInt();
    for(int i = 0; i < len; i++) {
        builder.withColor(Color.fromRGB(input.readInt(), input.readInt(), input.readInt()));
    }
    
    len = input.readInt();
    for(int i = 0; i < len; i++) {
        builder.withFade(Color.fromRGB(input.readInt(), input.readInt(), input.readInt()));
    }
    
    builder.with(FireworkEffect.Type.valueOf(input.readUTF()));
}
 
開發者ID:OrigamiDream,項目名稱:Leveled-Storage,代碼行數:20,代碼來源:FireworkEffectStorage.java

示例2: getFreshWater

import org.bukkit.Color; //導入依賴的package包/類
/**
 * l.add("��2����ֱ������");
 * @return ��ˮ
 */
public static ItemStack getFreshWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��3��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(10, 25)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2����ֱ������");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:20,代碼來源:Items.java

示例3: parseColor

import org.bukkit.Color; //導入依賴的package包/類
public static Color parseColor(String s) {
    String[] parts = s.split(";");
    if (parts.length != 3) {
        Color color;
        if (s.charAt(0) == '#' && s.length() >= 7) {//Hex color
            try {
                color = Color.fromRGB(Integer.parseUnsignedInt(s.substring(1, 7), 16));
            } catch (IllegalArgumentException e) {
                color = null;
            }
        } else
            color = COLOR_BY_NAME.get(s.toUpperCase());
        if (color == null)
            throw new InvalidConfigException("Invalid color \"" + s + "\", use \"R;G;B\", \"#RRGGBB\" or color name!");
        else return color;
    } else
        return Color.fromRGB(parseInt(parts[0]), parseInt(parts[1]), parseInt(parts[2]));
}
 
開發者ID:upperlevel,項目名稱:uppercore,代碼行數:19,代碼來源:ConfigUtil.java

示例4: getColor

import org.bukkit.Color; //導入依賴的package包/類
public static Color getColor(ChatColor color) {
    if (color == ChatColor.RED) {
        return Color.RED;
    } else if (color == ChatColor.BLUE) {
        return Color.BLUE;
    } else if (color == ChatColor.LIGHT_PURPLE) {
        return Color.FUCHSIA;
    } else if (color == ChatColor.GREEN) {
        return Color.GREEN;
    } else if (color == ChatColor.YELLOW) {
        return Color.YELLOW;
    } else if (color == ChatColor.GOLD) {
        return Color.ORANGE;
    } else if (color == ChatColor.AQUA) {
        return Color.AQUA;
    } else if (color == ChatColor.DARK_PURPLE) {
        return Color.PURPLE;
    } else {
        return Color.WHITE;
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:22,代碼來源:ColorConverter.java

示例5: getLakeWater

import org.bukkit.Color; //導入依賴的package包/類
/**
 * l.add("��2��ˮ,�����ճɿ�ˮ");
	l.add("��4��lֱ�Ӻ��м�������!");
	l.add("��b��Ҫ�á�e��l��ˮװ�á�b���������������!");
 * @return��ˮ
 */
public static ItemStack getLakeWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��2��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��2��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(5, 20)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(5, 15)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��4��lֱ�Ӻ��м�������!");
	l.add("��b��Ҫ�á�e��l��ˮװ�á�b���������������!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:25,代碼來源:Items.java

示例6: onRun

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void onRun() {
    double x, y, z;
    for (int i = 0; i < 50; i++) {
        int count = 20;
        do {
            count--;
            x = RMath.randDouble(0, 2);
            y = RMath.randDouble(0, 2);
            z = RMath.randDouble(0, 2);
        } while (count >= 0 && x * x + y * y + z * z > 4);
        x -= 1;
        z -= 1;
        loc.add(x, y, z);
        display(ParticleEffect.REDSTONE, loc, Color.WHITE);
        loc.subtract(x, y, z);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:19,代碼來源:FlightLaunchEffect.java

示例7: onRun

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void onRun() {
    double x, y, z;
    for (int i = 0; i < 50; i++) {
        int count = 20;
        do {
            count--;
            x = RMath.randDouble(0, 2);
            y = RMath.randDouble(0, 2);
            z = RMath.randDouble(0, 2);
        } while (count >= 0 && x * x + y * y + z * z > 4);
        x -= 1;
        z -= 1;
        loc.add(x, y, z);
        display(ParticleEffect.REDSTONE, loc, Color.AQUA);
        loc.subtract(x, y, z);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:19,代碼來源:MelodaBombEffect.java

示例8: onRun

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void onRun() {
    double x, y, z;
    for (int i = 0; i < 50; i++) {
        int count = 20;
        do {
            count--;
            x = RMath.randDouble(0, 2);
            y = RMath.randDouble(0, 2);
            z = RMath.randDouble(0, 2);
        } while (count >= 0 && x * x + y * y + z * z > 4);
        x -= 1;
        z -= 1;
        loc.add(x, y, z);
        display(ParticleEffect.REDSTONE, loc, Color.ORANGE);
        loc.subtract(x, y, z);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:19,代碼來源:HweenPumpkinBombEffect.java

示例9: onRun

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void onRun() {
    double x, z;
    for (double dy = 0; dy < 1.5; dy += 0.25) {
        loc.add(0, dy, 0);
        for (int i = 0; i < particles; i++) {
            double angle = (double) 2 * Math.PI * i / particles;
            x = Math.cos(angle) * radius;
            z = Math.sin(angle) * radius;
            loc.add(x, 0, z);
            display(particle, loc, Color.AQUA);
            loc.subtract(x, 0, z);
        }
        loc.subtract(0, dy, 0);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:17,代碼來源:FreezeSpellEndEffect.java

示例10: read

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void read(DataInputStream input) throws IOException {
    PotionEffectType type = PotionEffectType.getById(input.readInt());
    int duration = input.readInt();
    int amplifier = input.readInt();
    boolean aimbient = input.readBoolean();
    boolean particles = input.readBoolean();
    int r = input.readInt();
    int g = input.readInt();
    int b = input.readInt();
    Color color = Color.fromRGB(r, g, b);
    
    setValue(new PotionEffect(
            type,
            duration, amplifier,
            aimbient, particles, color
    ));
}
 
開發者ID:OrigamiDream,項目名稱:Leveled-Storage,代碼行數:19,代碼來源:PotionEffectStorage.java

示例11: castSpell

import org.bukkit.Color; //導入依賴的package包/類
public void castSpell(final LivingEntity caster, final MobData md, Player target) {
    final ArrayList<Entity> hit = new ArrayList<Entity>();
    final Location start = md.entity.getLocation();
    start.setY(start.getY() + 1.2);
    for (Vector v : getVectorsNormal(md.entity)) {
        ArrayList<Location> locs = RMath.calculateVectorPath(start.clone(), v, range, 2);
        int count = 0;
        for (int k = 0; k < locs.size(); k++) {
            final Location loc = locs.get(k);
            RScheduler.schedule(Spell.plugin, new Runnable() {
                public void run() {
                    ParticleEffect.REDSTONE.display(null, loc, Color.AQUA, 100, 0.2f, 0.2f, 0.2f, 1, 2);
                    int damage = (int) (md.getDamage() * 1.2);
                    ArrayList<Entity> damaged = Spell.damageNearby(damage, md.entity, loc, 1.0, hit, true, false, true);
                    hit.addAll(damaged);
                }
            }, 1 * count);
            if (k % 2 == 0)
                count++;
        }
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:23,代碼來源:MelodaIceSpell.java

示例12: read

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void read(DataInputStream input) throws IOException {
    super.read(input);
    
    getValue().setScaling(input.readBoolean());
    
    boolean hasLocationName = input.readBoolean();
    if(hasLocationName) {
        getValue().setLocationName(input.readUTF());
    }
    
    boolean hasColor = input.readBoolean();
    if(hasColor) {
        getValue().setColor(Color.fromRGB(input.readInt(), input.readInt(), input.readInt()));
    }
}
 
開發者ID:OrigamiDream,項目名稱:Leveled-Storage,代碼行數:17,代碼來源:MapMetaStorage.java

示例13: extractTextureFromEntity

import org.bukkit.Color; //導入依賴的package包/類
public static CustomBlockTexture extractTextureFromEntity(ArmorStand e) {
	CustomBlockTexture t = new CustomBlockTexture();
	short tex = (short) e.getHelmet().getDurability();
	Color c = ((LeatherArmorMeta) e.getHelmet().getItemMeta()).getColor();
	boolean g = e.getHelmet().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL);
	t.setLayerPrimary(tex, c, g);
	
	if (e.getEquipment().getItemInMainHand() == null) {
		return t;
	}
	
	short tex2 = (short) e.getEquipment().getItemInMainHand().getDurability();
	Color c2 = ((LeatherArmorMeta) e.getEquipment().getItemInMainHand().getItemMeta()).getColor();
	boolean g2 = e.getEquipment().getItemInMainHand().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL);
	t.setLayerSecondary(tex2, c2, g2);
	
	return t;
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:19,代碼來源:CustomBlockTexture.java

示例14: start

import org.bukkit.Color; //導入依賴的package包/類
@Override
public void start() {
    if (!kitsDir.exists()) {
        log.info("Kits dir doesn't exist, creating....");
        kitsDir.mkdirs();
    }

    File[] files = kitsDir.listFiles();
    if (files != null) {
        for (File file : files) {
            if (file.getName().endsWith(".json")) {
                availableKits.add(file.getName().replace(".json", ""));
            }
        }
    }
    log.info("There are " + availableKits.size() + " kits available.");

    // test stuff
    Kit kit = new Kit("DefaultKit");
    kit.addItem(0, new ItemBuilder(Material.STONE).name("Test Stone").build());
    kit.addItem(1, new ItemBuilder(Material.DIAMOND_SWORD).enchantment(Enchantment.DAMAGE_ALL, 5).name(ChatColor.RED + "Cool sword").amount(2).build());
    kit.addItem(2, new ItemBuilder(Material.LEATHER_BOOTS).enchantment(Enchantment.PROTECTION_EXPLOSIONS, 2).enchantment(Enchantment.PROTECTION_FALL, 5).name("Cool bots").amount(3).color(Color.RED).durability(10).lore("test").lore("Lore").build());
    createKit(kit);
    kit = loadKit("DefaultKit", new File(kitsDir, kit.getName() + ".json"));
    System.out.println(kit);
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLibv2,代碼行數:27,代碼來源:KitHandler.java

示例15: getIceWater

import org.bukkit.Color; //導入依賴的package包/類
/**
 * l.add("��2����ֱ������");
	l.add("��b��l���Ը����彵��!");
 * @return ��ˮ
 */
public static ItemStack getIceWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��3��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(10, 25)+"%");
	l.add("��3��l"+rs.getLoreTabel("Tem")+": ��c��l-"+Utils.random(0.1, 1.5)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2����ֱ������");
	l.add("��b��l���Ը����彵��!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:23,代碼來源:Items.java


注:本文中的org.bukkit.Color類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。