本文整理汇总了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()));
}
示例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;
}
示例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]));
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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
));
}
示例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++;
}
}
}
示例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()));
}
}
示例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;
}
示例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);
}
示例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;
}