本文整理汇总了Java中org.bukkit.Material.STONE_SWORD属性的典型用法代码示例。如果您正苦于以下问题:Java Material.STONE_SWORD属性的具体用法?Java Material.STONE_SWORD怎么用?Java Material.STONE_SWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.STONE_SWORD属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCraftItem
@EventHandler(priority = EventPriority.HIGH)
public void onCraftItem(CraftItemEvent event)
{
if( event.getRecipe().getResult().getType() == Material.STONE_SWORD
|| event.getRecipe().getResult().getType() == Material.IRON_SWORD
|| event.getRecipe().getResult().getType() == Material.GOLD_SWORD
|| event.getRecipe().getResult().getType() == Material.DIAMOND_SWORD
|| event.getRecipe().getResult().getType() == Material.LEATHER_BOOTS
|| event.getRecipe().getResult().getType() == Material.LEATHER_LEGGINGS
|| event.getRecipe().getResult().getType() == Material.LEATHER_CHESTPLATE
|| event.getRecipe().getResult().getType() == Material.LEATHER_HELMET
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_BOOTS
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_LEGGINGS
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_CHESTPLATE
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_HELMET
|| event.getRecipe().getResult().getType() == Material.GOLD_BOOTS
|| event.getRecipe().getResult().getType() == Material.GOLD_LEGGINGS
|| event.getRecipe().getResult().getType() == Material.GOLD_CHESTPLATE
|| event.getRecipe().getResult().getType() == Material.GOLD_HELMET
|| event.getRecipe().getResult().getType() == Material.IRON_BOOTS
|| event.getRecipe().getResult().getType() == Material.IRON_LEGGINGS
|| event.getRecipe().getResult().getType() == Material.IRON_CHESTPLATE
|| event.getRecipe().getResult().getType() == Material.IRON_HELMET
|| event.getRecipe().getResult().getType() == Material.DIAMOND_BOOTS
|| event.getRecipe().getResult().getType() == Material.DIAMOND_LEGGINGS
|| event.getRecipe().getResult().getType() == Material.DIAMOND_CHESTPLATE
|| event.getRecipe().getResult().getType() == Material.DIAMOND_HELMET)
{
if( event.getWhoClicked().getType() == EntityType.PLAYER )
{
Player p = (Player)event.getWhoClicked();
p.sendMessage("Sorry, you are not allowed to craft this item. Purchase it from a Safe Dock instead.");
}
event.setCancelled(false);
}
}
示例2: onCraftItem
private static void onCraftItem(Recipe recipe, CraftingInventory inventory)
{
if (recipe.getResult().getType() == Material.WOOD_SWORD
|| recipe.getResult().getType() == Material.STONE_SWORD
|| recipe.getResult().getType() == Material.IRON_SWORD
|| recipe.getResult().getType() == Material.GOLD_SWORD
|| recipe.getResult().getType() == Material.DIAMOND_SWORD)
inventory.setResult(new ItemStack(Material.AIR));
}
示例3: 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;
}