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


Java LeatherArmorMeta.setDisplayName方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: createColouredArmour

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

示例5: createColoredArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public static ItemStack createColoredArmor(Armor armor, Color color, String name)
{
	ItemStack leatherArmor = new ItemStack(armor.getMaterial());
	LeatherArmorMeta meta = (LeatherArmorMeta) leatherArmor.getItemMeta();
	meta.setColor(color);
	if(name != null)
	    meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
	leatherArmor.setItemMeta(meta);
	return leatherArmor;
}
 
开发者ID:Shortninja66,项目名称:StaffPlus,代码行数:11,代码来源:Items.java

示例6: getItemStackRaw

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
@Override
protected ItemStack getItemStackRaw()
{
	Material mat = getMaterial(typeId);
	ItemStack is = new ItemStack(mat);
	LeatherArmorMeta im = (LeatherArmorMeta) is.getItemMeta();
	im.setDisplayName(getName());
	is.setItemMeta(im);
	colorArmor(is, rgb);
	return is;
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:12,代码来源:BPArmor.java

示例7: playerJoinTeam

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public void playerJoinTeam(Player player, Team team) {
  if (team.getPlayers().size() >= team.getMaxPlayers()) {
    player.sendMessage(
        ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel._l(player, "errors.teamfull")));
    return;
  }

  if (team.addPlayer(player)) {
    this.nonFreePlayer(player);

    // Team color chestplate
    ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
    LeatherArmorMeta meta = (LeatherArmorMeta) chestplate.getItemMeta();
    meta.setColor(team.getColor().getColor());
    meta.setDisplayName(team.getChatColor() + team.getDisplayName());
    chestplate.setItemMeta(meta);

    player.getInventory().setItem(7, chestplate);
    player.updateInventory();
  } else {
    player.sendMessage(
        ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel._l(player, "errors.teamfull")));
    return;
  }

  this.updateScoreboard();

  if (this.isStartable() && this.getLobbyCountdown() == null) {
    GameLobbyCountdown lobbyCountdown = new GameLobbyCountdown(this);
    lobbyCountdown.runTaskTimer(BedwarsRel.getInstance(), 20L, 20L);
    this.setLobbyCountdown(lobbyCountdown);
  }

  player
      .sendMessage(ChatWriter.pluginMessage(ChatColor.GREEN + BedwarsRel
          ._l(player, "lobby.teamjoined",
              ImmutableMap.of("team", team.getDisplayName() + ChatColor.GREEN))));
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:39,代码来源:Game.java

示例8: create

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public static PigZombie create(Location l) {
	PigZombie police = (PigZombie) l.getWorld().spawnEntity(l, EntityType.PIG_ZOMBIE);
	Pig hov = (Pig) l.getWorld().spawnEntity(l, EntityType.PIG);
	
	police.setMaxHealth(80);
	police.setHealth(80);
	
	ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
	LeatherArmorMeta helmMeta = (LeatherArmorMeta) helm.getItemMeta();
	helmMeta.setColor(Color.BLACK);
	helmMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Helmet");
	helmMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	
	helm.setItemMeta(helmMeta);
	
	ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE);
	LeatherArmorMeta chestMeta = (LeatherArmorMeta) chest.getItemMeta();
	chestMeta.setColor(Color.BLACK);
	chestMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Vest");
	chestMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);

	chest.setItemMeta(chestMeta);
	
	ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
	LeatherArmorMeta legMeta = (LeatherArmorMeta) leg.getItemMeta();
	legMeta.setColor(Color.BLACK);
	legMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Leggings");
	legMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	
	leg.setItemMeta(legMeta);
	
	ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
	LeatherArmorMeta bootsMeta = (LeatherArmorMeta) boots.getItemMeta();
	bootsMeta.setColor(Color.BLACK);
	bootsMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Boots");
	bootsMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	bootsMeta.addEnchant(Enchantment.PROTECTION_FALL, 15, true);
	
	boots.setItemMeta(bootsMeta);
	
	EntityEquipment ee = police.getEquipment();
	
	ee.setHelmet(helm);
	ee.setChestplate(chest);
	ee.setLeggings(leg);
	ee.setBoots(boots);
	
	ee.setItemInOffHand(new ItemStack(Material.CARROT_STICK));
	
	police.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1, true, false));
	hov.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 4, true, false));
	
	hov.setPassenger(police);
	
	police.setCustomName("Officer");
	police.setCustomNameVisible(true);
	police.addScoreboardTag("law");
	
	
	return police;
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:62,代码来源:Police.java

示例9: colorArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入方法依赖的package包/类
public ItemStack colorArmor(ItemStack item, Player p) {
	if ((item.getItemMeta() instanceof LeatherArmorMeta)) {
		LeatherArmorMeta meta = (LeatherArmorMeta)item.getItemMeta();
		meta.setColor(ColorManager.random(p));
		if (item.getType() == Material.LEATHER_HELMET) {
			if (getConfig().getBoolean("random-color-names", true))
				meta.setDisplayName(ChatColor.values()[this.random.nextInt(ChatColor.values().length)] + this.helmet_name);
			else {
				meta.setDisplayName(this.helmet_name);
			}

		}
		else if (item.getType() == Material.LEATHER_CHESTPLATE) {
			if (getConfig().getBoolean("random-color-names", true))
				meta.setDisplayName(ChatColor.values()[this.random.nextInt(ChatColor.values().length)] + this.chest_name);
			else {
				meta.setDisplayName(this.chest_name);
			}
		}
		else if (item.getType() == Material.LEATHER_LEGGINGS) {
			if (getConfig().getBoolean("random-color-names", true))
				meta.setDisplayName(ChatColor.values()[this.random.nextInt(ChatColor.values().length)] + this.leggings_name);
			else {
				meta.setDisplayName(this.leggings_name);
			}

		}
		else if (item.getType() == Material.LEATHER_BOOTS) {
			if (getConfig().getBoolean("random-color-names", true))
				meta.setDisplayName(ChatColor.values()[this.random.nextInt(ChatColor.values().length)] + this.boots_name);
			else {
				meta.setDisplayName(this.boots_name);
			}

		}

		item.setItemMeta(meta);
	}

	return item;
}
 
开发者ID:lualzockt,项目名称:DiscoArmor,代码行数:42,代码来源:DiscoArmor.java


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