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


Java ItemMeta.getDisplayName方法代码示例

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


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

示例1: addSet

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
private void addSet(ItemStack item) {
    if (item == null)
        return;
    ItemMeta im = item.getItemMeta();
    if (im == null)
        return;
    if (!im.hasDisplayName())
        return;
    if (im.getDisplayName().startsWith("*"))
        return;
    String name = im.getDisplayName();
    for (String s : ItemBalance.SET_PREFIXES) {
        if (name.contains(s)) {
            if (armorSetCounter.containsKey(s))
                armorSetCounter.put(s, armorSetCounter.get(s) + 1);
            else
                armorSetCounter.put(s, 1);
            break;
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:22,代码来源:PlayerDataRPG.java

示例2: replaceString

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static void replaceString(ItemMeta meta, String target, String replacement) {
    if (meta == null)
        return;

    String display = meta.getDisplayName();
    if (display != null) {
        display = display.replace(target, replacement);
    }

    List<String> lore = meta.getLore();
    StringArrayList newLore = new StringArrayList();
    if (lore != null) {
        for (String element : lore) {
            newLore.add(element.replace(target, replacement));
        }
    }

    meta.setDisplayName(display);
    meta.setLore(newLore);
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:21,代码来源:ItemStacks.java

示例3: onButtonClick

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@EventHandler
public void onButtonClick(final InventoryClickEvent event) {
    ItemStack stack = event.getCurrentItem();
    final MatchPlayer player = this.getMatch().getPlayer(event.getWhoClicked());

    if(stack == null || player == null) return;
    if(stack.getType() != Material.WOOL && stack.getType() != Material.CARPET) return;
    ItemMeta meta = stack.getItemMeta();
    if(!meta.hasDisplayName()) return;
    String name = meta.getDisplayName();
    if(!name.startsWith(BUTTON_PREFIX)) return;

    event.setCancelled(true);

    final int score = stack.getAmount();
    if(!isScoreValid(score)) return;

    this.getMatch().getScheduler(MatchScope.LOADED).createTask(() -> {
        Integer oldScore = playerRatings.get(player);
        if(oldScore == null || oldScore != score) {
            player.playSound(Sound.UI_BUTTON_CLICK, 1, 2);
            rate(player, score);
        }
        else {
            player.getBukkit().closeInventory();
        }
    });
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:29,代码来源:MapRatingsMatchModule.java

示例4: ItemMetaMock

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemMetaMock(ItemMeta meta)
{
	if (meta.hasDisplayName())
	{
		displayName = meta.getDisplayName();
	}
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:8,代码来源:ItemMetaMock.java

示例5: onLoad

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@Override
public void onLoad(Gui gui, RawItemPosition item) {
	item.getItem().setDurability(getDataFromBoolean(this.enabled).getData());
	
	ItemMeta m = item.getItem().getItemMeta();
	this.oname = m.getDisplayName();
	m.setDisplayName(this.oname.replace("$nstate", enabled ? "Disable" : "Enable"));
	item.getItem().setItemMeta(m);
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:10,代码来源:ToggleButton.java

示例6: getDisplayName

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public String getDisplayName(String def) {
    ItemMeta meta = getHandle().getItemMeta();
    String displayName = meta.getDisplayName();
    return displayName != null ? displayName : def;
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:6,代码来源:ItemWrapper.java

示例7: onBlockBreak

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent evt) {
	Player player = evt.getPlayer();
	if (player == null) {
		return;
	}
	ItemStack itemStack = player.getItemInHand();
	if (itemStack.getType() != Material.DIAMOND_PICKAXE) {
		return;
	}
	ItemMeta itemMeta = itemStack.getItemMeta();
	if (itemMeta == null) {
		return;
	}
	String displayName = itemMeta.getDisplayName();
	if (displayName == null) {
		return;
	}
	if (!displayName.contains(ITEM_NAME)) {
		return;
	}
	Block block = evt.getBlock();
	if (block == null) {
		return;
	}
	Location location = block.getLocation();
	String playerName = player.getName();
	Location[][] arrayOfLocation;
	int j = (arrayOfLocation = LocationUtil.getExplosivePickaxeBreakLocations(location)).length;
	for (int i = 0; i < j; i++) {
		Location[] locations = arrayOfLocation[i];
		Location[] arrayOfLocation1;
		int m = (arrayOfLocation1 = locations).length;
		for (int k = 0; k < m; k++) {
			Location FOR_location = arrayOfLocation1[k];
			ClaimedResidence claimedResidence = RESIDENCE_MAMAGER.getByLoc(FOR_location);
			if (claimedResidence != null) {
				ResidencePermissions perms = claimedResidence.getPermissions();
				boolean hasdestroy = perms.playerHas(playerName, Flags.destroy, true);
				if ((!hasdestroy) && (!player.hasPermission("residence.bypass.destroy"))) {
					this.RESIDENCE.msg(player, lm.Flag_Deny, new Object[] { Flags.destroy });
					evt.setCancelled(true);
					return;
				}
			}
		}
	}
}
 
开发者ID:Soldier233,项目名称:SlimefunBugFixer,代码行数:49,代码来源:ListenersRes4.java


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