当前位置: 首页>>代码示例>>Java>>正文


Java LeatherArmorMeta.setColor方法代码示例

本文整理汇总了Java中org.bukkit.inventory.meta.LeatherArmorMeta.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java LeatherArmorMeta.setColor方法的具体用法?Java LeatherArmorMeta.setColor怎么用?Java LeatherArmorMeta.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.meta.LeatherArmorMeta的用法示例。


在下文中一共展示了LeatherArmorMeta.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@Override
public void apply(Player player, MatchTeam matchTeam) {
    // Set leather armor in armor slots to team color if not set initially
    if (slot >= 100 && !hasColor && itemStack.getType().toString().contains("LEATHER_")) {
        LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta();
        leatherArmorMeta.setColor(ColorConverter.getColor(matchTeam.getColor()));
        itemStack.setItemMeta(leatherArmorMeta);
    }

    if (slot == 100) player.getInventory().setBoots(itemStack);
    else if (slot == 101) player.getInventory().setLeggings(itemStack);
    else if (slot == 102) player.getInventory().setChestplate(itemStack);
    else if (slot == 103) player.getInventory().setHelmet(itemStack);
    else if (slot == -106) player.getInventory().setItemInOffHand(itemStack);
    else player.getInventory().setItem(slot, itemStack);
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:17,代码来源:ItemKitNode.java

示例2: build

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
/**
 * Get the final {@link ItemStack} with all the attributes you have been adding
 *
 * @return the {@link ItemStack} of this {@link ItemBuilder}
 */
@Override
public ItemStack build() {
    ItemStack s = new ItemStack(this.getMaterial());
    s.setAmount(this.getAmount());
    s.setDurability(this.getDamage());
    LeatherArmorMeta m = (LeatherArmorMeta) s.getItemMeta();

    for (ItemFlag iflag : this.getAllItemflags()) {
        m.addItemFlags(iflag);
    }
    m.setDisplayName(this.getName());
    m.setLore(this.getLore());
    m.setColor(color);
    s.setItemMeta(m);
    for (Map.Entry<Enchantment, Integer> temp : this.getAllEnchantments().entrySet()) {
        s.addUnsafeEnchantment(temp.getKey(), temp.getValue());
    }
    return s;
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:25,代码来源:LeatherItemBuilder.java

示例3: coloredArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
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;
}
 
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:21,代码来源:Loadout.java

示例4: disguise

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public boolean disguise(Player player, String teamName) {
    if (!isValid(teamName)) {
        return false;
    }
    Team team = teams.get(teamName);
    ItemStack tshirt = new ItemStack(Material.LEATHER_CHESTPLATE);
    LeatherArmorMeta tShirtMeta = (LeatherArmorMeta) tshirt.getItemMeta();
    tShirtMeta.setColor(team.tshirtColor);
    tShirtMeta.setDisplayName(team.chatColor + team.tshirtName);
    backToNormal(player, false);
    player.setDisplayName(team.chatColor + player.getName());
    tshirt.setItemMeta(tShirtMeta);
    player.getInventory().setChestplate(tshirt);
    player.setGameMode(GameMode.ADVENTURE);
    TagAPI.refreshPlayer(player);
    _disguisedPlayers_mutex.lock();
    try {
        disguisedPlayers.put(player, team);
    } finally {
        _disguisedPlayers_mutex.unlock();
    }
    score.scoreTeams.get(teamName).addPlayer(player);
    updateScoreboards();
    return true;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:26,代码来源:TeamManager.java

示例5: run

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@Override
public void run() {
    Color c = getNext(player.getHealth());
    if(last == c) {
        // dont update armor if health didnt change
        return;
    }
    for (ItemStack is : inv.getArmorContents()){
        if (is != null && is.getItemMeta() instanceof LeatherArmorMeta) {
            if (!Utility.isWorthy(is.getItemMeta())) {
                continue;
            }
            LeatherArmorMeta lam = (LeatherArmorMeta) is.getItemMeta();
            lam.setColor(c);
            is.setItemMeta(lam);
        }
    }
}
 
开发者ID:nsporillo,项目名称:RBGArmor,代码行数:19,代码来源:HealthWorker.java

示例6: processMeta

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@Override
public void processMeta(Player player, ItemMeta m) {
    super.processMeta(player, m);
    LeatherArmorMeta meta = (LeatherArmorMeta) m;
    if(color != null)
        meta.setColor(color.resolve(player));
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:8,代码来源:LeatherArmorCustomItem.java

示例7: placeBlock

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public ArmorStand placeBlock(Location l) {
	ArmorStand block = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	block.setSmall(true);
	block.setGravity(false);
	block.setCustomName("CustomBlock");
	block.setCustomNameVisible(false);
	block.setInvulnerable(true);
	block.setVisible(false);
	block.setMarker(true);
	block.setSilent(true);
	
	ItemStack a = new ItemStack(Material.LEATHER_BOOTS);
	a.setDurability((short) primary.getTexture());
	LeatherArmorMeta am = (LeatherArmorMeta) a.getItemMeta();
	am.setColor(primary.getColor());
	am.setUnbreakable(true);
	if (primary.isGlowing()) {
		am.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	}
	a.setItemMeta(am);
	block.setHelmet(a);
	
	if (secondary != null) {
		ItemStack b = new ItemStack(Material.LEATHER_BOOTS);
		b.setDurability((short) secondary.getTexture());
		LeatherArmorMeta bm = (LeatherArmorMeta) b.getItemMeta();
		bm.setColor(secondary.getColor());
		bm.setUnbreakable(true);
		if (secondary.isGlowing()) {
			System.out.println("H");
			bm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
		}
		b.setItemMeta(bm);
		block.getEquipment().setItemInMainHand(b);
	}
	
	return block;
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:39,代码来源:CustomBlockTexture.java

示例8: createTeamJoinButton

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
private ItemStack createTeamJoinButton(final MatchPlayer player, final Team team) {
    ItemStack item = new ItemStack(Button.TEAM_JOIN.material);
    String capacityMessage = this.getTeamSizeDescription(team.getPlayers().size(), team.getMaxPlayers());
    List<String> lore = Lists.newArrayList(capacityMessage);

    final JoinResult result = jmm.queryJoin(player, JoinRequest.user(team));
    if(result.isAllowed()) {
        final String label = result.isRejoin() ? "teamSelection.picker.clickToRejoin"
                                               : "teamSelection.picker.clickToJoin";
        lore.add(renderer.renderLegacy(new Component(new TranslatableComponent(label), ChatColor.GREEN), player.getBukkit()));
    } else if(result.message().isPresent()) {
        lore.add(renderer.renderLegacy(new Component(result.message().get(), ChatColor.RED), player.getBukkit()));
        result.extra().forEach(line -> {
            lore.add(renderer.renderLegacy(line, player.getBukkit()));
        });
    }

    LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta();
    meta.addItemFlags(ItemFlag.values());
    meta.setColor(team.getFullColor());
    meta.setDisplayName(team.getColor().toString() + ChatColor.BOLD + team.getName());
    meta.setLore(lore);
    meta.addItemFlags(ItemFlag.values()); // Hides a lot more than potion effects
    item.setItemMeta(meta);

    return item;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:28,代码来源:PickerMatchModule.java

示例9: colorArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
private ItemStack colorArmor(ItemStack stack, Color color)
{
    LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
    meta.setColor(color);
    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:9,代码来源:ExpressBotaniaDisplayer.java

示例10: createColouredArmour

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public static ItemStack createColouredArmour(Material m, Color colour) {
	ItemStack i = new ItemStack(m);
	i = applyItemFlags(i);
	LeatherArmorMeta lam = (LeatherArmorMeta) i.getItemMeta();
	lam.setColor(colour);
	i.setItemMeta(lam);
	return i;
}
 
开发者ID:jusjus112,项目名称:OnlineChecker-Spigot-SQL-Support,代码行数:9,代码来源:UtilItem.java

示例11: setArmourColour

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public static ItemStack setArmourColour(ItemStack i, Color c) {
	Material t = i.getType();
	if (!(t == Material.LEATHER_HELMET || t == Material.LEATHER_CHESTPLATE || t == Material.LEATHER_LEGGINGS
			|| t == Material.LEATHER_BOOTS)) {
		return i;
	}
	LeatherArmorMeta m = (LeatherArmorMeta) i.getItemMeta();
	m.setColor(c);
	i.setItemMeta(m);
	i = applyItemFlags(i);
	return i;
}
 
开发者ID:jusjus112,项目名称:OnlineChecker-Spigot-SQL-Support,代码行数:13,代码来源:UtilItem.java

示例12: setColor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
/**
 * Sets the color of the itemStack. Only works on leatherItems
 *
 * @param color color
 * @return itemStack
 */
public ItemStackBuilder setColor(Color color) {
    if (this.getItemMeta() instanceof LeatherArmorMeta) {
        final LeatherArmorMeta meta = (LeatherArmorMeta) this.getItemMeta();
        meta.setColor(color);
        this.setItemMeta(meta);
    }
    return this;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:15,代码来源:ItemStackBuilder.java

示例13: getArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
/**
 * Paint a given ItemStack into gray
 *
 * @param stack Leather armor part
 *
 * @return Colored leather armor part
 */
public ItemStack getArmor(ItemStack stack)
{
    LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
    meta.setColor(Color.GRAY);
    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:16,代码来源:DeadCorpses.java

示例14: setWardenInv

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
private void setWardenInv(Player target) throws SQLException {
    RankManager.setGuardLevel(target, 2);
    RankManager.setWantedLevel(target, 0);
    target.getInventory().clear();

    ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
    LeatherArmorMeta bootsMeta = (LeatherArmorMeta)boots.getItemMeta();
    bootsMeta.setColor(Color.fromRGB(224, 33, 15));
    boots.setItemMeta(bootsMeta);
    target.getInventory().setBoots(boots);

    ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
    LeatherArmorMeta leggingsMeta = (LeatherArmorMeta)leggings.getItemMeta();
    leggingsMeta.setColor(Color.fromRGB(224, 33, 15));
    leggings.setItemMeta(leggingsMeta);
    target.getInventory().setLeggings(leggings);

    ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE);
    LeatherArmorMeta chestMeta = (LeatherArmorMeta)chest.getItemMeta();
    chestMeta.setColor(Color.fromRGB(224, 33, 15));
    chest.setItemMeta(chestMeta);
    target.getInventory().setChestplate(chest);

    ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
    LeatherArmorMeta helmetMeta = (LeatherArmorMeta)helmet.getItemMeta();
    helmetMeta.setColor(Color.fromRGB(224, 33, 15));
    helmet.setItemMeta(helmetMeta);
    target.getInventory().setHelmet(helmet);
    try{
        ScrapsUtil.setScraps(target, ScrapsUtil.getScraps(target));
    } catch(SQLException e){
        e.printStackTrace();
    }
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:35,代码来源:SetStatusCommand.java

示例15: setGuardInv

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
private void setGuardInv(Player target) throws SQLException {
    RankManager.setGuardLevel(target, 1);
    RankManager.setWantedLevel(target, 0);
    target.getInventory().clear();

    ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
    LeatherArmorMeta bootsMeta = (LeatherArmorMeta)boots.getItemMeta();
    bootsMeta.setColor(Color.fromRGB(145, 0, 0));
    boots.setItemMeta(bootsMeta);
    target.getInventory().setBoots(boots);

    ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
    LeatherArmorMeta leggingsMeta = (LeatherArmorMeta)leggings.getItemMeta();
    leggingsMeta.setColor(Color.fromRGB(145, 0, 0));
    leggings.setItemMeta(leggingsMeta);
    target.getInventory().setLeggings(leggings);

    ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE);
    LeatherArmorMeta chestMeta = (LeatherArmorMeta)chest.getItemMeta();
    chestMeta.setColor(Color.fromRGB(145, 0, 0));
    chest.setItemMeta(chestMeta);
    target.getInventory().setChestplate(chest);

    ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
    LeatherArmorMeta helmetMeta = (LeatherArmorMeta)helmet.getItemMeta();
    helmetMeta.setColor(Color.fromRGB(145, 0, 0));
    helmet.setItemMeta(helmetMeta);
    target.getInventory().setHelmet(helmet);
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:30,代码来源:SetStatusCommand.java


注:本文中的org.bukkit.inventory.meta.LeatherArmorMeta.setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。