本文整理汇总了Java中org.bukkit.Material.GOLD_PICKAXE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.GOLD_PICKAXE属性的具体用法?Java Material.GOLD_PICKAXE怎么用?Java Material.GOLD_PICKAXE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.GOLD_PICKAXE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTool
static boolean isTool(ItemStack item) {
if (item == null) return false;
final Material material = item.getType();
// shears
if (material == Material.SHEARS) return true;
// wood tools
if (material == Material.WOOD_SWORD || material == Material.WOOD_AXE || material == Material.WOOD_HOE || material == Material.WOOD_PICKAXE || material == Material.WOOD_SPADE) {
return true;
}
// stone tools
if (material == Material.STONE_SWORD || material == Material.STONE_AXE || material == Material.STONE_HOE || material == Material.STONE_PICKAXE || material == Material.STONE_SPADE) {
return true;
}
// iron tools
if (material == Material.IRON_SWORD || material == Material.IRON_AXE || material == Material.IRON_HOE || material == Material.IRON_PICKAXE || material == Material.IRON_SPADE) {
return true;
}
// gold tools
if (material == Material.GOLD_SWORD || material == Material.GOLD_AXE || material == Material.GOLD_HOE || material == Material.GOLD_PICKAXE || material == Material.GOLD_SPADE) {
return true;
}
// diamond tools
if (material == Material.DIAMOND_SWORD || material == Material.DIAMOND_AXE || material == Material.DIAMOND_HOE || material == Material.DIAMOND_PICKAXE || material == Material.DIAMOND_SPADE) {
return true;
}
return false;
}
示例2: getProgressBar
public ItemStack getProgressBar()
{
return new ItemStack(Material.GOLD_PICKAXE);
}
示例3: onInventoryClick
@EventHandler
public void onInventoryClick(InventoryClickEvent e)
{
Inventory inv = e.getInventory();
if(inv instanceof AnvilInventory)
{
AnvilInventory anvil = (AnvilInventory)inv;
InventoryView view = e.getView();
int rawSlot = e.getRawSlot();
// compare raw slot to the inventory view to make sure we are in the upper inventory
if(rawSlot == view.convertSlot(rawSlot))
{
// 2 = result slot
if(rawSlot == 2)
{
// item in the left slot
ItemStack item = anvil.getContents()[0];
if(item != null)
{
if
(
item.getType() == Material.GOLD_AXE
|| item.getType() == Material.GOLD_PICKAXE
|| item.getType() == Material.GOLD_SPADE
|| item.getType() == Material.GOLD_HOE
|| item.getType() == Material.GOLD_SWORD
|| item.getType() == Material.WOOD_AXE
|| item.getType() == Material.WOOD_PICKAXE
|| item.getType() == Material.WOOD_SPADE
|| item.getType() == Material.WOOD_HOE
|| item.getType() == Material.WOOD_SWORD
)
{
e.setCancelled(true);
e.getWhoClicked().closeInventory();
e.getWhoClicked().sendMessage(ChatColor.RED + Survival.Words.get("You cannot rename or repair ") + item.getItemMeta().getDisplayName() + ChatColor.RED + Survival.Words.get("period"));
}
}
}
}
}
}
示例4: registerAbilities
/**
* Registers all the abilities
*/
private void registerAbilities() {
abilities = new ArrayList<>();
Ability ability;
// Haste
ability = new Ability("Haste", Material.GOLD_BOOTS, 10, 100);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Gives Haste Effect");
ability.addDescription(ChatColor.GRAY + "Haste Level: " + ChatColor.RED + "I");
abilities.add(ability);
// Poison
ability = new Ability("Poison", Material.BEETROOT, 15, 150);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
ability.addDescription(ChatColor.GRAY + "Poisons target enemy");
ability.addDescription(ChatColor.GRAY + "Poison Level: " + ChatColor.RED + "I");
ability.addDescription(ChatColor.GRAY + "Poison Duration: " + ChatColor.RED + "3 seconds");
abilities.add(ability);
// AoE (4 blocks)
ability = new Ability("AoE", Material.GOLD_PICKAXE, 20, 750);
ability.setItems(Arrays.asList(ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Destroys 4 blocks instead of 1");
abilities.add(ability);
// Magnet
ability = new Ability("Magnet", Material.DETECTOR_RAIL, 25, 250);
ability.setItems(Arrays.asList(ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Small chance to get crate key");
ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
abilities.add(ability);
// Flame
ability = new Ability("Flame", Material.BLAZE_POWDER, 15, 750);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
ability.addDescription(ChatColor.GRAY + "Sets target on fire");
ability.addDescription(ChatColor.GRAY + "Fire Duration: " + ChatColor.RED + "3 seconds");
abilities.add(ability);
// High Jump
ability = new Ability("High Jump", Material.ELYTRA, 20, 200);
ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
ability.addDescription(ChatColor.GRAY + "Jump 2 blocks high");
ability.addDescription(ChatColor.GRAY + "Jump Level: " + ChatColor.RED + "II");
abilities.add(ability);
// Speed
ability = new Ability("Speed", Material.FEATHER, 15, 150);
ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
ability.addDescription(ChatColor.GRAY + "Gives speed boost");
ability.addDescription(ChatColor.GRAY + "Speed Level: " + ChatColor.RED + "I");
abilities.add(ability);
// Lucky Repair
ability = new Ability("Lucky Repair", Material.ANVIL, 25, 250);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Small chance to repair item");
ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
abilities.add(ability);
}