當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。