本文整理汇总了Java中org.bukkit.Material.IRON_SWORD属性的典型用法代码示例。如果您正苦于以下问题:Java Material.IRON_SWORD属性的具体用法?Java Material.IRON_SWORD怎么用?Java Material.IRON_SWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.IRON_SWORD属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
/**
* Handle the GUI stuff.
*/
@EventHandler
public void onClick(InventoryClickEvent event) {
Inventory inventory = event.getInventory();
if (inventory.getTitle().contains("Summary for ")) {
event.setCancelled(true);
ItemStack item = event.getCurrentItem();
Player viewer = (Player) event.getWhoClicked();
if (item.getType() == Material.IRON_SWORD) {
Player player = Bukkit.getPlayer(inventory.getTitle().split(" ")[2]);
if (player == null) {
viewer.sendMessage(ChatColor.RED + "This player has logged out.");
viewer.closeInventory();
return;
}
Arc.getArcPlayerManager().scheduleBan(player);
}
}
}
示例2: 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);
}
}
示例3: 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));
}
示例4: 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;
}
示例5: openStatsGUI
public void openStatsGUI(Player p){
inv = Bukkit.createInventory(null, 27, ChatColor.DARK_GRAY + "Stats");
/*List<String> armamentLore = new ArrayList();
armamentLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getArmamentHakiLevel(p.getName()));
armamentLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getArmamentHakiXP(p.getName()));
armamentLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getArmamentHakiLevel(p.getName()) + 1])- (getArmamentHakiXP(p.getName()))));
List<String> observationLore = new ArrayList();
observationLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getObservationHakiLevel(p.getName()));
observationLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getObservationHakiXP(p.getName()));
observationLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getObservationHakiLevel(p.getName()) + 1])- (getObservationHakiXP(p.getName()))));
List<String> conquerorLore = new ArrayList();
conquerorLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getConquerorHakiLevel(p.getName()));
conquerorLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getConquerorHakiXP(p.getName()));
conquerorLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getConquerorHakiLevel(p.getName()) + 1])- (getConquerorHakiXP(p.getName()))));
*/
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
ItemStack className = new ItemStack(Material.BOOK);
ItemMeta classNameMeta = className.getItemMeta();
ItemStack kills = new ItemStack(Material.IRON_SWORD);
ItemMeta killsMeta = kills.getItemMeta();
ItemStack deaths = new ItemStack(Material.BONE);
ItemMeta deathsMeta = deaths.getItemMeta();
ItemStack armament = new ItemStack(Material.IRON_INGOT);
ItemMeta armamentMeta = armament.getItemMeta();
ItemStack observation = new ItemStack(Material.NETHER_STAR);
ItemMeta observationMeta = observation.getItemMeta();
ItemStack conqueror = new ItemStack(Material.BLAZE_ROD);
ItemMeta conquerorMeta = observation.getItemMeta();
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
skullMeta.setOwner(p.getName());
skullMeta.setDisplayName(ChatColor.GOLD + p.getName() + "'s Stats");
skull.setItemMeta(skullMeta);
classNameMeta.setDisplayName(ChatColor.GOLD + "Class: " + ChatColor.BLUE + Datafiles.getClass(p.getName()));
className.setItemMeta(classNameMeta);
killsMeta.setDisplayName(ChatColor.GOLD + "Kills: " + ChatColor.BLUE + Datafiles.getKills(p.getName()));
kills.setItemMeta(killsMeta);
deathsMeta.setDisplayName(ChatColor.GOLD + "Deaths: " + ChatColor.BLUE + Datafiles.getDeaths(p.getName()));
deaths.setItemMeta(deathsMeta);
armamentMeta.setDisplayName(ChatColor.GOLD + "Armament Haki");
// armamentMeta.setLore(armamentLore);
armament.setItemMeta(armamentMeta);
observationMeta.setDisplayName(ChatColor.GOLD + "Observation Haki");
//observationMeta.setLore(observationLore);
observation.setItemMeta(observationMeta);
conquerorMeta.setDisplayName(ChatColor.GOLD + "Conqueror Haki");
// conquerorMeta.setLore(conquerorLore);
conqueror.setItemMeta(conquerorMeta);
inv.setItem(0, skull);
inv.setItem(9, className);
inv.setItem(4, kills);
inv.setItem(13, deaths);
inv.setItem(8, armament);
inv.setItem(17, observation);
inv.setItem(26, conqueror);
p.openInventory(inv);
}
示例6: openJoinGUI
public static void openJoinGUI(Player p) {
inv = Bukkit.createInventory(null, 27, title);
List<String> WizardLore = new ArrayList<String>();
List<String> SwordsmanLore = new ArrayList<String>();
List<String> ArcherLore = new ArrayList<String>();
List<String> TopLore = new ArrayList<String>();
ItemStack WizardChoose = new ItemStack(Material.BLAZE_ROD);
ItemMeta WizardMeta = WizardChoose.getItemMeta();
ItemStack SwordsmanChoose = new ItemStack(Material.IRON_SWORD);
ItemMeta SwordsmanMeta = SwordsmanChoose.getItemMeta();
ItemStack ArcherChoose = new ItemStack(Material.BOW);
ItemMeta ArcherMeta = ArcherChoose.getItemMeta();
ItemStack Top = new ItemStack(Material.WRITTEN_BOOK);
ItemMeta TopMeta = Top.getItemMeta();
WizardMeta.setDisplayName(Main.colorThis("&9Wizard"));
WizardMeta.setLore(WizardLore);
WizardChoose.setItemMeta(WizardMeta);
TopMeta.setDisplayName(Main.colorThis("&c&lRealm of Mythos"));
SwordsmanMeta.setDisplayName(Main.colorThis("&4Swordsman"));
SwordsmanMeta.setLore(SwordsmanLore);
SwordsmanChoose.setItemMeta(SwordsmanMeta);
ArcherMeta.setDisplayName(Main.colorThis("&cArcher"));
ArcherMeta.setLore(ArcherLore);
ArcherChoose.setItemMeta(ArcherMeta);
TopMeta.setLore(TopLore);
Top.setItemMeta(TopMeta);
inv.setItem(4, Top);
inv.setItem(12, WizardChoose);
inv.setItem(13, SwordsmanChoose);
inv.setItem(14, ArcherChoose);
ItemStack block = new ItemStack(Material.STAINED_GLASS_PANE);
block.getItemMeta().setDisplayName("");
for(int i = 0; i < 27; i++){
if(i == 4 || i == 12 || i == 13 || i == 14){
}else{
inv.setItem(i, block);
}
}
p.openInventory(inv);
}
示例7: BasicKitHandler
public BasicKitHandler()
{
this.kits = new HashSet<>();
if (MWAPI.getConfig().isDefaultKitsEnabled())
{
// *** FIGHTER KIT *** //
// Fighter Armor
ItemStack fighterHelmet = new ItemStack(Material.IRON_HELMET, 1);
fighterHelmet.addEnchantment(Enchantment.DAMAGE_ALL, 1);
KitItem fighterHelmetKitItem = MWAPI.getKitItemBuilder()
.stack(fighterHelmet)
.drop(false)
.unbreakable(true)
.create();
ItemStack fighterChestplate = new ItemStack(Material.IRON_CHESTPLATE, 1);
fighterChestplate.addEnchantment(Enchantment.DAMAGE_ALL, 1);
KitItem fighterChestplateKitItem = MWAPI.getKitItemBuilder()
.stack(fighterChestplate)
.drop(false)
.unbreakable(true)
.create();
ItemStack fighterPants = new ItemStack(Material.IRON_LEGGINGS, 1);
fighterPants.addEnchantment(Enchantment.DAMAGE_ALL, 1);
KitItem fighterPantsKitItem = MWAPI.getKitItemBuilder()
.stack(fighterPants)
.drop(false)
.unbreakable(true)
.create();
ItemStack fighterBoots = new ItemStack(Material.IRON_BOOTS, 1);
fighterBoots.addEnchantment(Enchantment.DAMAGE_ALL, 1);
KitItem fighterBootsKitItem = MWAPI.getKitItemBuilder()
.stack(fighterPants)
.drop(false)
.unbreakable(true)
.create();
// Fighter Items
ItemStack fighterSword = new ItemStack(Material.IRON_SWORD, 1);
fighterSword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
KitItem fighterSwordKitItem = MWAPI.getKitItemBuilder()
.stack(fighterSword)
.drop(false)
.unbreakable(true)
.create();
ItemStack fighterFood = new ItemStack(Material.GOLDEN_APPLE, 10);
KitItem fighterFoodKitItem = MWAPI.getKitItemBuilder()
.stack(fighterSword)
.drop(true)
.unbreakable(true)
.create();
registerKit(MWAPI.getKitBuilder("Fighter")
.setBoots(fighterBootsKitItem)
.setPants(fighterPantsKitItem)
.setChestPlate(fighterChestplateKitItem)
.setHelmet(fighterHelmetKitItem)
.setItemAt(0, fighterSwordKitItem)
.setItemAt(1, fighterFoodKitItem)
.create());
}
}