本文整理汇总了Java中org.bukkit.Material.DIAMOND_PICKAXE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.DIAMOND_PICKAXE属性的具体用法?Java Material.DIAMOND_PICKAXE怎么用?Java Material.DIAMOND_PICKAXE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.DIAMOND_PICKAXE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createItemStack
static /* varargs */ ItemStack createItemStack(String... lores)
{
ItemStack stack = new ItemStack(Material.DIAMOND_PICKAXE, 1);
ItemMeta im = stack.getItemMeta();
im.setDisplayName("");
ArrayList < String > lore = new ArrayList<>();
int n = lores.length;
int n2 = 0;
while (n2 < n)
{
String str = lores[n2];
lore.add(str); ++n2;
}
im.setLore(lore);
stack.setItemMeta(im);
return stack;
}
示例2: onCraftItem
@EventHandler
public void onCraftItem(CraftItemEvent event)
{
if (event.getRecipe().getResult().getType() == Material.DIAMOND_PICKAXE)
{
ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE, 1);
pickaxe.addEnchantment(Enchantment.DIG_SPEED, 3);
event.getInventory().setResult(pickaxe);
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () ->
{
for (ItemStack stack : event.getWhoClicked().getInventory().getContents())
if (stack != null && stack.getType() == Material.DIAMOND_PICKAXE && !stack.containsEnchantment(Enchantment.DIG_SPEED))
stack.addEnchantment(Enchantment.DIG_SPEED, 3);
}, 5L);
}
}
示例3: getRepresentation
/**
* {@inheritDoc}
*/
@Override
public default ItemStack getRepresentation() {
ItemStack stack = new ItemStack(Material.DIAMOND_PICKAXE);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "Repair");
stack.setItemMeta(meta);
stack.setDurability((short) 1);
return stack;
}
示例4: onCommand
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
if(!(sender instanceof Player)){
sender.sendMessage("Only players can use this command.");
return true;
}
if(args != null && args.length > 0){
if(args[0].equalsIgnoreCase("toggle")){
active = !active;
for(Player p: Bukkit.getOnlinePlayers()){
if(p.isOp()){
p.sendMessage(String.format("Ghost Block protection is now %s", active ? "active" : "disabled"));
}
}
return true;
}
return false;
}
Player player = (Player)sender;
ItemStack pic = new ItemStack(Material.DIAMOND_PICKAXE);
ItemMeta meta = pic.getItemMeta();
meta.setUnbreakable(true);
meta.addEnchant(Enchantment.DIG_SPEED, 5, true);
pic.setItemMeta(meta);
player.getInventory().addItem(pic);
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 60000, 2, true, false), true);
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 60000, 1, true, false), true);
return true;
}
示例5: onBlockDamage
/**
* Set obsidian only breakable by a diamond pickage
*
* @param event Event
*/
@EventHandler
public void onBlockDamage(BlockDamageEvent event)
{
if (event.getBlock().getType() == Material.OBSIDIAN && event.getItemInHand().getType() != Material.DIAMOND_PICKAXE)
event.setCancelled(true);
}
示例6: 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;
}
示例7: getDrops
@Override
public Collection<ItemStack> getDrops( FlexPlayer player, int data ) {
ItemStack itemStack = player.getItemInHand();
if( itemStack != null && ( itemStack.getType() == Material.IRON_PICKAXE || itemStack.getType() == Material.DIAMOND_PICKAXE ) ) {
return Collections.singletonList( new ItemStack( Material.DIAMOND ) );
}
return Collections.emptyList();
}
示例8: getProgressBar
public ItemStack getProgressBar()
{
return new ItemStack(Material.DIAMOND_PICKAXE);
}
示例9: isPick
static boolean isPick(ItemStack item)
{
return item != null && item.getType() == Material.DIAMOND_PICKAXE && item.hasItemMeta() && item.getItemMeta().hasLore();
}
示例10: getProgressBar
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.DIAMOND_PICKAXE);
}
示例11: onBlockBreak
@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;
}
}
}
}
}