下面列出了org.bukkit.inventory.meta.PotionMeta#setColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public PotionMeta convert(PotionMeta potionMeta) {
Objects.requireNonNull(potionMeta, "potionMeta");
Duration duration = this.config.duration();
String formattedDuration = this.formatDuration(this.config.duration());
if (this.config.color != null) {
potionMeta.setColor(this.config.color);
}
potionMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
potionMeta.setDisplayName(ChatColor.AQUA + this.config.name());
potionMeta.setLore(Collections.singletonList(ChatColor.BLUE + MessageFormat.format(this.config.description(), formattedDuration)));
PersistentDataContainer container = potionMeta.getPersistentDataContainer();
container.set(this.potionKey, PersistentDataType.BYTE, TRUE);
container.set(this.durationSecondsKey, PersistentDataType.INTEGER, (int) duration.getSeconds());
return potionMeta;
}
public CustomPotion(String name, Color color, PotionEffect effect, String... lore) {
super(Material.POTION, name, lore);
PotionMeta meta = (PotionMeta) getItemMeta();
meta.setColor(color);
meta.addCustomEffect(effect, true);
setItemMeta(meta);
}
@Override
public PotionMeta setPotionColor(PotionMeta potionMeta, Color color){
potionMeta.setColor(color);
return potionMeta;
}
@Override
public PotionMeta setPotionColor(PotionMeta potionMeta, Color color){
potionMeta.setColor(color);
return potionMeta;
}