下面列出了org.bukkit.Color#RED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void setGlass(World world, double x, double y, double z, Map<Location, Color> boundingBox, Material mat, Player player) {
if (y < 1 || y >= world.getMaxHeight()) {
return;
}
Location location = new Location(world, x, y, z);
Block block = location.getBlock();
if (block.getType() != Material.AIR ||
block.getRelative(BlockFace.DOWN).getType() == Material.GRASS_PATH ||
block.getRelative(BlockFace.DOWN).getType() == Material.FARMLAND) {
return;
}
Color color = Color.RED;
if (mat == Material.BLUE_STAINED_GLASS) {
color = Color.BLUE;
} else if (mat == Material.LIME_STAINED_GLASS) {
color = Color.GREEN;
}
BlockData blockData = mat.createBlockData();
boundingBox.put(new Location(world, x, y, z), color);
player.sendBlockChange(location, blockData);
}
private static ItemStack[] coloredArmor(AnniTeam team)
{
Color c;
if(team.getColor() == ChatColor.RED)
c = Color.RED;
else if(team.getColor() == ChatColor.BLUE)
c = Color.BLUE;
else if(team.getColor() == ChatColor.GREEN)
c = Color.GREEN;
else
c = Color.YELLOW;
ItemStack[] stacks = KitUtils.getLeatherArmor();
for(ItemStack stack : stacks)
{
LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
meta.setColor(c);
stack.setItemMeta(meta);
}
return stacks;
}
@BeforeAll
public static void load() {
server = MockBukkit.mock();
SlimefunPlugin plugin = MockBukkit.load(SlimefunPlugin.class);
Category category = new Category(new NamespacedKey(plugin, "cooler_test"), new CustomItem(Material.SNOWBALL, "Mr. Freeze"));
SlimefunItemStack item = new SlimefunItemStack("TEST_COOLER", Material.SNOWBALL, "&6Test Cooler", "", "&7ID: <ID>");
cooler = new Cooler(18, category, item, RecipeType.NULL, new ItemStack[9]);
cooler.register(plugin);
SlimefunItemStack juiceItem = new SlimefunItemStack("TEST_JUICE", Color.RED, new PotionEffect(PotionEffectType.HEALTH_BOOST, 6, 0), "&4Test Juice");
juice = new Juice(category, juiceItem, RecipeType.NULL, new ItemStack[9]);
juice.register(plugin);
listener = new CoolerListener(plugin, cooler);
}
private static Color fireworkColor(int i) {
switch (i) {
default:
case 1:
return Color.SILVER;
case 2:
return Color.AQUA;
case 3:
return Color.BLACK;
case 4:
return Color.BLUE;
case 5:
return Color.FUCHSIA;
case 6:
return Color.GRAY;
case 7:
return Color.GREEN;
case 8:
return Color.LIME;
case 9:
return Color.MAROON;
case 10:
return Color.NAVY;
case 11:
return Color.OLIVE;
case 12:
return Color.ORANGE;
case 13:
return Color.PURPLE;
case 14:
return Color.RED;
case 15:
return Color.YELLOW;
case 16:
return Color.TEAL;
}
}
public BigBangEffect(EffectManager effectManager) {
super(effectManager);
color = Color.RED;
type = EffectType.REPEATING;
period = 2;
iterations = 400;
asynchronous = false;
}
@Override
public void display(Particle particle, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount, float size, Color color, Material material, byte materialData, double range, List<Player> targetPlayers) {
// Legacy colorizeable particles
if (color != null && (particle == Particle.SPELL_MOB || particle == Particle.SPELL_MOB_AMBIENT)) {
displayLegacyColored(particle, center, speed, color, range, targetPlayers);
return;
}
if (particle == Particle.ITEM_CRACK) {
displayItem(particle, center, offsetX, offsetY, offsetZ, speed, amount, material, materialData, range, targetPlayers);
return;
}
Object data = null;
if (particle == Particle.BLOCK_CRACK || particle == Particle.BLOCK_DUST || particle == Particle.FALLING_DUST) {
if (material == null || material == Material.AIR) {
return;
}
data = material.createBlockData();
if (data == null) {
return;
}
}
if (particle == Particle.REDSTONE) {
// color is required for 1.13
if (color == null) {
color = Color.RED;
}
data = new Particle.DustOptions(color, size);
}
display(particle, center, offsetX, offsetY, offsetZ, speed, amount, data, range, targetPlayers);
}
private static Color getColor(String color) {
if (color != null) {
switch (color.toUpperCase()) {
case "AQUA":
return Color.AQUA;
case "BLACK":
return Color.BLACK;
case "BLUE":
return Color.BLUE;
case "FUCHSIA":
return Color.FUCHSIA;
case "GRAY":
return Color.GRAY;
case "GREEN":
return Color.GREEN;
case "LIME":
return Color.LIME;
case "MAROON":
return Color.MAROON;
case "NAVY":
return Color.NAVY;
case "OLIVE":
return Color.OLIVE;
case "ORANGE":
return Color.ORANGE;
case "PURPLE":
return Color.PURPLE;
case "RED":
return Color.RED;
case "SILVER":
return Color.SILVER;
case "TEAL":
return Color.TEAL;
case "WHITE":
return Color.WHITE;
case "YELLOW":
return Color.YELLOW;
}
try {
String[] rgb = color.split(",");
return Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));
} catch (Exception ignore) {
}
}
return null;
}
public static Color[] getColors() {
return new Color[] {Color.AQUA, Color.BLACK, Color.BLUE, Color.FUCHSIA, Color.GRAY, Color.GREEN, Color.LIME, Color.MAROON, Color.NAVY, Color.OLIVE, Color.ORANGE, Color.PURPLE, Color.RED, Color.SILVER, Color.TEAL, Color.WHITE, Color.YELLOW};
}