本文整理汇总了Java中org.bukkit.entity.Item.setCustomNameVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Item.setCustomNameVisible方法的具体用法?Java Item.setCustomNameVisible怎么用?Java Item.setCustomNameVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Item
的用法示例。
在下文中一共展示了Item.setCustomNameVisible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInteract
import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.getClickedBlock().getType() == Material.CAULDRON) {
if (e.getClickedBlock().getLocation().add(0, -1, 0).getBlock().getType() == Material.DIAMOND_BLOCK) {
Item item = e.getPlayer().getWorld().dropItem(e.getClickedBlock().getLocation().add(0.5, 2, 0.5), e.getPlayer().getEquipment().getItemInMainHand());
item.setMetadata("item-owner", new FixedMetadataValue(NationZ.plugin, e.getPlayer().getUniqueId().toString()));
item.setVelocity(new Vector(0, 0, 0));
item.setCustomName(item.getName());
item.setCustomNameVisible(true);
e.getPlayer().getEquipment().setItemInMainHand(null);
e.setCancelled(true);
}
}
}
}
示例2: onGameTick
import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onGameTick(GameTickEvent event) {
if(event.getTicksInSecond() < potionDropPerSecond) {
ItemStack itemStack = new ItemStack(Material.POTION, 1, (byte) 8197);
Item entity = this.potionDropLocation.getWorld().dropItem(potionDropLocation, itemStack);
entity.setCustomName(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Potion");
entity.setCustomNameVisible(true);
entity.setVelocity(new Vector(0, 0.47, 0).add(Utils.getRandomCircleVector()
.multiply(potionVelocityMultiplier*Math.random())));
}
}
示例3: insertItem
import org.bukkit.entity.Item; //导入方法依赖的package包/类
private void insertItem(Player p, Block b) {
final ItemStack stack = p.getInventory().getItemInMainHand();
if (stack != null) {
PlayerInventory.consumeItemInHand(p);
String nametag = StringUtils.formatItemName(stack, false);
Item entity = b.getWorld().dropItem(b.getLocation().add(0.5, 1.2, 0.5), new CustomItem(new CustomItem(stack, 1), "&5&dALTAR &3Probe - &e" + System.nanoTime()));
entity.setVelocity(new Vector(0, 0.1, 0));
entity.setMetadata("no_pickup", new FixedMetadataValue(SlimefunStartup.instance, "altar_item"));
entity.setCustomNameVisible(true);
entity.setCustomName(nametag);
p.playSound(b.getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.3F, 0.3F);
}
}
示例4: spawnItem
import org.bukkit.entity.Item; //导入方法依赖的package包/类
private void spawnItem(Arena arena, BoostItem item) {
final Location location = arena.getRandomFieldPosition(this.getRandom());
final Item item1 = location.getWorld().dropItem(location, item.generate());
item1.setCustomNameVisible(true);
item1.setCustomName(item.getDisplayName());
this.getLDroppedItems().put(item1, item);
}
示例5: onItemSpawn
import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onItemSpawn(ItemSpawnEvent e) {
if (e.isCancelled()) {
return;
}
Item item = e.getEntity();
ItemStack is = item.getItemStack();
if (isMoneyItem(is)) {
item.setCustomName(is.getItemMeta().getDisplayName());
item.setCustomNameVisible(true);
}
}
示例6: spawnMoney
import org.bukkit.entity.Item; //导入方法依赖的package包/类
public void spawnMoney(Player p,float money,Location l){
if(dropMulti.containsKey(p.getUniqueId())) money*=dropMulti.get(p.getUniqueId());
Item item = l.getWorld().dropItemNaturally(l, getItem(Float.valueOf(money).intValue()));
String m = String.valueOf(money);
if (!m.contains(".")) m=m+".0";
item.setCustomName(language.get("nameSyntax").replace("{money}", m));
item.setCustomNameVisible(true);
}