本文整理汇总了Java中org.bukkit.Material.EXP_BOTTLE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.EXP_BOTTLE属性的具体用法?Java Material.EXP_BOTTLE怎么用?Java Material.EXP_BOTTLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.EXP_BOTTLE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInteractableItem
/**
* checks if this item is interactable
*/
public static boolean isInteractableItem(ItemStack item) {
if (item == null || item.getType() == Material.AIR) {
return false;
}
if (item.getType().isBlock()) {
return true;
}
if (item.getType() == Material.REDSTONE || item.getType() == Material.WATER_BUCKET || item.getType() == Material.LAVA_BUCKET) {
return true;
}
if (item.getType() == Material.MONSTER_EGG) {
return true;
}
if (item.getType() == Material.EGG || item.getType() == Material.SNOW_BALL || item.getType() == Material.BOW || item.getType() == Material.ENDER_PEARL || item.getType() == Material.EYE_OF_ENDER || item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.EXP_BOTTLE || item.getType() == Material.FIREWORK_CHARGE) {
return true;
}
if (item.getType().isEdible()) {
return true;
}
return false;
}
示例2: createExpBottle
/**
* Builds a bottled exp {@link ItemStack} based on the experience.
*
* @param experience
* the experience to create with
* @return the {@link ItemStack}
*/
private ItemStack createExpBottle(int experience) {
ItemStack stack = new ItemStack(Material.EXP_BOTTLE, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(BOTTLED_EXP_DISPLAY_NAME);
meta.setLore(Lists.newArrayList(ChatColor.WHITE.toString() + experience + ChatColor.GOLD + " Experience"));
stack.setItemMeta(meta);
return stack;
}
示例3: XPVillagerTrade
public XPVillagerTrade(int xp, ItemStack RewardItem) {
super(new ItemStack(Material.EXP_BOTTLE, xp), RewardItem);
setXP(xp);
}
示例4: meleeEnchantGUI
public static void meleeEnchantGUI(Player player){
meleeGUI = Bukkit.createInventory(null, 9, ChatColor.DARK_GRAY + "Melee Enchantments");
ItemStack filler = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
ItemMeta fillerMeta = filler.getItemMeta();
fillerMeta.setDisplayName(ChatColor.GRAY + "");
filler.setItemMeta(fillerMeta);
ItemStack back = new ItemStack(Material.ARROW);
ItemMeta backMeta = back.getItemMeta();
backMeta.setDisplayName(ChatColor.RED + "Previous");
back.setItemMeta(backMeta);
ItemStack thunderingStrike = new ItemStack(Material.BLAZE_ROD);
ItemMeta thunderMeta = thunderingStrike.getItemMeta();
thunderMeta.setDisplayName(ChatColor.GOLD + "Thundering Strike");
thunderMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Thundering Strike").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Thundering Strike").getRarity().getName()));
thunderingStrike.setItemMeta(thunderMeta);
ItemStack lifeSteal = new ItemStack(Material.FLINT);
ItemMeta lifeStealMeta = lifeSteal.getItemMeta();
lifeStealMeta.setDisplayName(ChatColor.RED + "Life Steal");
lifeStealMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Life Steal").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Life Steal").getRarity().getName()));
lifeSteal.setItemMeta(lifeStealMeta);
ItemStack lastHope = new ItemStack(Material.GHAST_TEAR);
ItemMeta lastHopeMeta = lastHope.getItemMeta();
lastHopeMeta.setDisplayName(ChatColor.LIGHT_PURPLE + "Last Hope");
lastHopeMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Last Hope").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Last Hope").getRarity().getName()));
lastHope.setItemMeta(lastHopeMeta);
ItemStack EXPSteal = new ItemStack(Material.EXP_BOTTLE);
ItemMeta EXPStealMeta = EXPSteal.getItemMeta();
EXPStealMeta.setDisplayName(ChatColor.GREEN + "Experience Steal");
EXPStealMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Experience Steal").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Experience Steal").getRarity().getName()));
EXPSteal.setItemMeta(EXPStealMeta);
meleeGUI.setItem(0, filler);
meleeGUI.setItem(1, thunderingStrike);
meleeGUI.setItem(2, filler);
meleeGUI.setItem(3, lifeSteal);
meleeGUI.setItem(4, filler);
meleeGUI.setItem(5, lastHope);
meleeGUI.setItem(6, filler);
meleeGUI.setItem(7, EXPSteal);
meleeGUI.setItem(8, back);
player.openInventory(meleeGUI);
}
示例5: shopInvent
public Inventory shopInvent(){
Inventory inv = Bukkit.createInventory(null, 36, shopName);
ItemStack str = new ItemStack(Material.POTION, 1, (short) 8201);
ItemMeta strM = str.getItemMeta();
List<String> strL = new ArrayList<String>();
strM.setDisplayName(ChatColor.RED + "Strength");
strL.add(ChatColor.GOLD + "120 Tokens");
strM.setLore(strL);
str.setItemMeta(strM);
inv.addItem(str);
ItemStack gaps = new ItemStack(Material.GOLDEN_APPLE, 2, (short) 1);
ItemMeta gapsM = gaps.getItemMeta();
List<String> gapsL = new ArrayList<String>();
gapsM.setDisplayName(ChatColor.RED + "Golden Apple");
gapsL.add(ChatColor.GOLD + "10 Tokens");
gapsM.setLore(gapsL);
gaps.setItemMeta(gapsM);
inv.addItem(gaps);
for(int i = 0; i < 6; i++){
inv.addItem(getItemSpacer());
}
ItemStack ljm = new ItemStack(Material.DAYLIGHT_DETECTOR);
ItemMeta ljmM = ljm.getItemMeta();
List<String> ljmL = new ArrayList<String>();
ljmM.setDisplayName(ChatColor.RED + "Leave/Join Messages");
ljmL.add(ChatColor.GOLD + "400 Tokens");
ljmM.setLore(ljmL);
ljm.setItemMeta(ljmM);
inv.addItem(ljm);
ItemStack exp = new ItemStack(Material.EXP_BOTTLE,20);
ItemMeta expM = exp.getItemMeta();
List<String> expL = new ArrayList<String>();
expM.setDisplayName(ChatColor.RED + "Experience Bottles");
expL.add(ChatColor.GOLD + "1 Token");
expM.setLore(expL);
exp.setItemMeta(expM);
inv.addItem(exp);
// remove the item spacers
inv.remove(Material.STAINED_GLASS_PANE);
return inv;
}
示例6: shopClick
@EventHandler
public void shopClick(InventoryClickEvent e){
if(e.getInventory().getName().equals(shopName) && e.getRawSlot() > 36){
e.setCancelled(true);
return;
}
if(e.getClickedInventory() == null){
e.setCancelled(true);
return;
}
if(e.getClickedInventory().getName() == null){
e.setCancelled(true);
return;
}
if(e.getClickedInventory().getName().equals(shopName)){
Player p = (Player) e.getWhoClicked();
String uuid = p.getUniqueId().toString();
long tokens = getTokens(uuid);
e.setCancelled(true);
if(! e.getCurrentItem().hasItemMeta()) return;
String name = e.getCurrentItem().getItemMeta().getDisplayName();
if(name.equals(ChatColor.RED + "Strength")){
if(tokens < 120){
p.sendMessage(tag + ChatColor.RED + "You don\'t have enough tokens!");
p.closeInventory();
}else{
ItemStack str = new ItemStack(Material.POTION, 1, (short) 8201);
p.getInventory().addItem(str);
setTokens(uuid, getTokens(uuid) - 120);
p.sendMessage(tag + ChatColor.BLUE + "Your purchase was a success");
}
}
if(name.equals(ChatColor.RED + "Golden Apple")){
if(tokens < 10){
p.sendMessage(tag + ChatColor.RED + "You don\'t have enough tokens!");
p.closeInventory();
}else{
ItemStack gaps = new ItemStack(Material.GOLDEN_APPLE, 2, (short) 1);
p.getInventory().addItem(gaps);
setTokens(uuid, getTokens(uuid) - 10);
p.sendMessage(tag + ChatColor.BLUE + "Your purchase was a success");
}
}
if(name.equals(ChatColor.RED + "Leave/Join Messages")){
if(tokens < 400){
p.sendMessage(tag + ChatColor.RED + "You don\'t have enough tokens!");
p.closeInventory();
}else{
if(isSjm(uuid)){
p.sendMessage(tag + ChatColor.RED + "You already have this!");
p.closeInventory();
}else{
setSjm(uuid, true);
setTokens(uuid, getTokens(uuid) - 400);
p.sendMessage(tag + ChatColor.BLUE + "Your purchase was a success");
}
}
}
if(name.equals(ChatColor.RED + "Experience Bottles")){
if(tokens < 1){
p.sendMessage(tag + ChatColor.RED + "You don\'t have enough tokens!");
p.closeInventory();
}else{
ItemStack exp = new ItemStack(Material.EXP_BOTTLE,20);
p.getInventory().addItem(exp);
setTokens(uuid, getTokens(uuid) - 1);
p.sendMessage(tag + ChatColor.BLUE + "Your purchase was a success");
}
}
}
}