org.bukkit.entity.Item.getCustomName()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.bukkit.entity.Item.getCustomName()方法的一些代码示例,展示了Item.getCustomName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getCustomName()方法的具体详情如下:
包路径:org.bukkit.entity.Item
类名称:Item
方法名:getCustomName

Item.getCustomName介绍

暂无

代码示例

代码示例来源:origin: jiongjionger/NeverLag

if (displaying || (item.getCustomName() == null || !item.isCustomNameVisible())) {
  item.setCustomName(message);
  item.setCustomNameVisible(message != null);

代码示例来源:origin: TheBusyBiscuit/Slimefun4

@Override
  public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
    Item stack = AncientAltarListener.findItem(b);
    if (stack != null) { 
      stack.removeMetadata("item_placed", SlimefunStartup.instance);
      b.getWorld().dropItem(b.getLocation(), AncientAltarListener.fixItemStack(stack.getItemStack(), stack.getCustomName()));
      stack.remove();
    }
    return true;
  }
});

代码示例来源:origin: TheBusyBiscuit/Slimefun4

private void checkPedestal(Block pedestal) {
  Item item = AncientAltarListener.findItem(pedestal);
  if (item == null) abort();
  else {
    particles.add(pedestal.getLocation().add(0.5, 1.5, 0.5));
    items.add(AncientAltarListener.fixItemStack(item.getItemStack(), item.getCustomName()));
    pedestal.getWorld().playSound(pedestal.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 5F, 2F);
    try {
      l.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE,pedestal.getLocation().add(0.5, 1.5, 0.5),16, 0.3F, 0.2F, 0.3F);
      l.getWorld().spawnParticle(Particle.CRIT_MAGIC,pedestal.getLocation().add(0.5, 1.5, 0.5), 8,0.3F, 0.2F, 0.3F);
    } catch (Exception e) {
      e.printStackTrace();
    }
    item.remove();
    pedestal.removeMetadata("item_placed", SlimefunStartup.instance);
  }
}

代码示例来源:origin: TheBusyBiscuit/Slimefun4

e.getPlayer().getInventory().addItem(fixItemStack(stack.getItemStack(), stack.getCustomName()));
e.getPlayer().playSound(b.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1F, 1F);
PlayerInventory.update(e.getPlayer());
    for (Block pedestal: pedestals) {
      Item stack = findItem(pedestal);
      if (stack != null) input.add(fixItemStack(stack.getItemStack(), stack.getCustomName()));

相关文章