本文整理汇总了Java中org.bukkit.inventory.meta.LeatherArmorMeta.getColor方法的典型用法代码示例。如果您正苦于以下问题:Java LeatherArmorMeta.getColor方法的具体用法?Java LeatherArmorMeta.getColor怎么用?Java LeatherArmorMeta.getColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.meta.LeatherArmorMeta
的用法示例。
在下文中一共展示了LeatherArmorMeta.getColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CardboardMetaLeatherArmor
import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public CardboardMetaLeatherArmor(ItemStack leather) {
this.id = leather.getTypeId();
LeatherArmorMeta meta = (LeatherArmorMeta) leather.getItemMeta();
this.color = new CardboardColor(meta.getColor());
}
示例2: show
import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
/**
*
* @param board
* @param obj
*/
private void show(Scoreboard board, Objective obj) {
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
obj.setDisplayName(Lang.TITLE.toString() + " Debug");
player.setScoreboard(board);
if (!main.getWorkers().containsKey(player.getUniqueId())) {
return;
}
ItemStack[] armor = player.getInventory().getArmorContents();
ItemStack is = null;
// find first piece of armor to debug
for (int i = 0; i < armor.length; i++) {
if (armor[i] != null) {
is = armor[i];
break;
}
}
Color color = null;
if (is != null && is.hasItemMeta()) {
ItemMeta im = is.getItemMeta();
if (im instanceof LeatherArmorMeta) {
LeatherArmorMeta lam = (LeatherArmorMeta) im;
color = lam.getColor();
}
}
if (color != null) {
Score red = obj.getScore("Red: ");
red.setScore(color.getRed());
Score green = obj.getScore("Green: ");
green.setScore(color.getGreen());
Score blue = obj.getScore("Blue: ");
blue.setScore(color.getBlue());
}
}
示例3: getColor
import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
/**
* Gets the 32-bit color of an {@link ItemStack} if it has any.
*
* @param item The {@link ItemStack}.
*
* @return The {@link Color} or null if item does not have 32-bit color.
*/
@Nullable
public static Color getColor(ItemStack item) {
PreCon.notNull(item);
ItemMeta meta = item.getItemMeta();
if (meta instanceof LeatherArmorMeta) {
LeatherArmorMeta laMeta = (LeatherArmorMeta)meta;
return laMeta.getColor();
}
return null;
}
示例4: initialize
import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@Override
public SerialItemData initialize(ItemStack stack) {
ItemMeta meta = stack.getItemMeta();
if(meta instanceof LeatherArmorMeta) {
valid = true;
LeatherArmorMeta leatherMeta = (LeatherArmorMeta)meta;
color = leatherMeta.getColor();
}
return this;
}
示例5: CardboardMetaLeatherArmor
import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public CardboardMetaLeatherArmor(ItemStack leather) {
this.id = leather.getTypeId();
LeatherArmorMeta meta = (LeatherArmorMeta) leather.getItemMeta();
this.color = new CardboardColor(meta.getColor());
}