Java Code Examples for org.bukkit.Material#LEATHER_CHESTPLATE

The following examples show how to use org.bukkit.Material#LEATHER_CHESTPLATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KitUtils.java    From AnnihilationPro with MIT License 5 votes vote down vote up
public static ItemStack[] getLeatherArmor()
{
	ItemStack[] stacks = new ItemStack[]{ new ItemStack(Material.LEATHER_BOOTS),
			new ItemStack(Material.LEATHER_LEGGINGS), 
			new ItemStack(Material.LEATHER_CHESTPLATE),
			new ItemStack(Material.LEATHER_HELMET)};
	
	for(int x = 0; x < stacks.length; x++)
		stacks[x] = KitUtils.addSoulbound(stacks[x]);
	return stacks;
}
 
Example 2
Source File: Game.java    From BedwarsRel with GNU General Public License v3.0 5 votes vote down vote up
public void playerJoinTeam(Player player, Team team) {
  if (team.getPlayers().size() >= team.getMaxPlayers()) {
    player.sendMessage(
        ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel._l(player, "errors.teamfull")));
    return;
  }

  if (team.addPlayer(player)) {
    this.nonFreePlayer(player);

    // Team color chestplate
    ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
    LeatherArmorMeta meta = (LeatherArmorMeta) chestplate.getItemMeta();
    meta.setColor(team.getColor().getColor());
    meta.setDisplayName(team.getChatColor() + team.getDisplayName());
    chestplate.setItemMeta(meta);

    player.getInventory().setItem(7, chestplate);
    player.updateInventory();
  } else {
    player.sendMessage(
        ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel._l(player, "errors.teamfull")));
    return;
  }

  this.updateScoreboard();

  if (this.isStartable() && this.getLobbyCountdown() == null) {
    GameLobbyCountdown lobbyCountdown = new GameLobbyCountdown(this);
    lobbyCountdown.runTaskTimer(BedwarsRel.getInstance(), 20L, 20L);
    this.setLobbyCountdown(lobbyCountdown);
  }

  player
      .sendMessage(ChatWriter.pluginMessage(ChatColor.GREEN + BedwarsRel
          ._l(player, "lobby.teamjoined",
              ImmutableMap.of("team", team.getDisplayName() + ChatColor.GREEN))));
}
 
Example 3
Source File: ItemStackBuilder.java    From ZombieEscape with GNU General Public License v2.0 5 votes vote down vote up
public ItemStackBuilder withColor(Color color) {
    Material type = ITEM_STACK.getType();
    if (type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS) {
        LeatherArmorMeta meta = (LeatherArmorMeta) ITEM_STACK.getItemMeta();
        meta.setColor(color);
        ITEM_STACK.setItemMeta(meta);
        return this;
    } else {
        throw new IllegalArgumentException("withColor is only applicable for leather armor!");
    }
}
 
Example 4
Source File: CraftItemStack.java    From Carbon with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static ItemMeta getItemMeta(net.minecraft.server.v1_7_R4.ItemStack item) {
	if (!hasItemMeta(item)) {
		return CraftItemFactory.instance().getItemMeta(getType(item));
	}
	Material mat = getType(item);
	if (mat == Material.WRITTEN_BOOK || mat == Material.BOOK_AND_QUILL) {
		return new CraftMetaBook(item.tag);
	}
	if (mat == Material.SKULL_ITEM) {
		return new CraftMetaSkull(item.tag);
	}
	if (mat == Material.LEATHER_HELMET || mat == Material.LEATHER_CHESTPLATE || mat == Material.LEATHER_LEGGINGS || mat == Material.LEATHER_BOOTS) {
		return new CraftMetaLeatherArmor(item.tag);
	}
	if (mat == Material.POTION) {
		return new CraftMetaPotion(item.tag);
	}
	if (mat == Material.MAP) {
		return new CraftMetaMap(item.tag);
	}
	if (mat == Material.FIREWORK) {
		return new CraftMetaFirework(item.tag);
	}
	if (mat == Material.FIREWORK_CHARGE) {
		return new CraftMetaCharge(item.tag);
	}
	if (mat == Material.ENCHANTED_BOOK) {
		return new CraftMetaEnchantedBook(item.tag);
	}
	if (mat.toString().equals("BANNER")) {
		return new BannerMeta(item.getData(), item.tag);
	}
	return new CraftMetaItem(item.tag);
}
 
Example 5
Source File: CraftItemFactory.java    From Carbon with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ItemMeta getItemMeta(Material material, CraftMetaItem meta) {
	if (material == Material.AIR) {
		return null;
	}
	if (material == Material.WRITTEN_BOOK || material == Material.BOOK_AND_QUILL) {
		return (meta instanceof CraftMetaBook) ? meta : new CraftMetaBook(meta);
	}
	if (material == Material.SKULL_ITEM) {
		return (meta instanceof CraftMetaSkull) ? meta : new CraftMetaSkull(meta);
	}
	if (material == Material.LEATHER_HELMET || material == Material.LEATHER_CHESTPLATE || material == Material.LEATHER_LEGGINGS || material == Material.LEATHER_BOOTS) {
		return (meta instanceof CraftMetaLeatherArmor) ? meta : new CraftMetaLeatherArmor(meta);
	}
	if (material == Material.POTION) {
		return (meta instanceof CraftMetaPotion) ? meta : new CraftMetaPotion(meta);
	}
	if (material == Material.MAP) {
		return (meta instanceof CraftMetaMap) ? meta : new CraftMetaMap(meta);
	}
	if (material == Material.FIREWORK) {
		return (meta instanceof CraftMetaFirework) ? meta : new CraftMetaFirework(meta);
	}
	if (material == Material.FIREWORK_CHARGE) {
		return (meta instanceof CraftMetaCharge) ? meta : new CraftMetaCharge(meta);
	}
	if (material == Material.ENCHANTED_BOOK) {
		return (meta instanceof CraftMetaEnchantedBook) ? meta : new CraftMetaEnchantedBook(meta);
	}
	if (material.toString().equals("BANNER")) {
		if (meta != null && BannerMeta.class.isAssignableFrom(meta.getClass())) {
			return meta;
		} else {
			return new BannerMeta(meta);
		}
	}
	return new CraftMetaItem(meta);
}
 
Example 6
Source File: DamageEffect.java    From Civs with GNU General Public License v3.0 4 votes vote down vote up
public static int adjustForArmor(int damage, Player player) {
    org.bukkit.inventory.PlayerInventory inv = player.getInventory();
    ItemStack boots = inv.getBoots();
    ItemStack helmet = inv.getHelmet();
    ItemStack chest = inv.getChestplate();
    ItemStack pants = inv.getLeggings();
    double red = 0.0;
    if (helmet != null) {
        if (helmet.getType() == Material.LEATHER_HELMET) red = red + 0.04;
        else if (helmet.getType() == Material.GOLDEN_HELMET) red = red + 0.08;
        else if (helmet.getType() == Material.CHAINMAIL_HELMET) red = red + 0.08;
        else if (helmet.getType() == Material.IRON_HELMET) red = red + 0.08;
        else if (helmet.getType() == Material.DIAMOND_HELMET) red = red + 0.12;
    }

    if (boots != null) {
        if (boots.getType() == Material.LEATHER_BOOTS) red = red + 0.04;
        else if (boots.getType() == Material.GOLDEN_BOOTS) red = red + 0.04;
        else if (boots.getType() == Material.CHAINMAIL_BOOTS) red = red + 0.04;
        else if (boots.getType() == Material.IRON_BOOTS) red = red + 0.08;
        else if (boots.getType() == Material.DIAMOND_BOOTS) red = red + 0.12;
    }

    if (pants != null) {
        if (pants.getType() == Material.LEATHER_LEGGINGS) red = red + 0.08;
        else if (pants.getType() == Material.GOLDEN_LEGGINGS) red = red + 0.12;
        else if (pants.getType() == Material.CHAINMAIL_LEGGINGS) red = red + 0.16;
        else if (pants.getType() == Material.IRON_LEGGINGS) red = red + 0.20;
        else if (pants.getType() == Material.DIAMOND_LEGGINGS) red = red + 0.24;
    }

    if (chest != null) {
        if (chest.getType() == Material.LEATHER_CHESTPLATE) red = red + 0.12;
        else if (chest.getType() == Material.GOLDEN_CHESTPLATE) red = red + 0.20;
        else if (chest.getType() == Material.CHAINMAIL_CHESTPLATE) red = red + 0.20;
        else if (chest.getType() == Material.IRON_CHESTPLATE) red = red + 0.24;
        else if (chest.getType() == Material.DIAMOND_CHESTPLATE) red = red + 0.32;
    }
    if (red == 0) {
        return damage;
    } else {
        return (int) Math.round(damage / (1 - red));
    }
}
 
Example 7
Source File: ArmorRatingCondition.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Boolean execute(String playerID) throws QuestRuntimeException {
    PlayerInventory inv = PlayerConverter.getPlayer(playerID).getInventory();
    int rating = 0;
    ItemStack boots = inv.getBoots();
    ItemStack helmet = inv.getHelmet();
    ItemStack chest = inv.getChestplate();
    ItemStack leggings = inv.getLeggings();
    if (helmet != null) {
        if (helmet.getType() == Material.LEATHER_HELMET)
            rating += 1;
        else if (helmet.getType() == Material.GOLDEN_HELMET)
            rating += 2;
        else if (helmet.getType() == Material.CHAINMAIL_HELMET)
            rating += 2;
        else if (helmet.getType() == Material.IRON_HELMET)
            rating += 2;
        else if (helmet.getType() == Material.DIAMOND_HELMET)
            rating += 3;
    }
    if (boots != null) {
        if (boots.getType() == Material.LEATHER_BOOTS)
            rating += 1;
        else if (boots.getType() == Material.GOLDEN_BOOTS)
            rating += 1;
        else if (boots.getType() == Material.CHAINMAIL_BOOTS)
            rating += 1;
        else if (boots.getType() == Material.IRON_BOOTS)
            rating += 2;
        else if (boots.getType() == Material.DIAMOND_BOOTS)
            rating += 3;
    }
    if (leggings != null) {
        if (leggings.getType() == Material.LEATHER_LEGGINGS)
            rating += 2;
        else if (leggings.getType() == Material.GOLDEN_LEGGINGS)
            rating += 3;
        else if (leggings.getType() == Material.CHAINMAIL_LEGGINGS)
            rating += 4;
        else if (leggings.getType() == Material.IRON_LEGGINGS)
            rating += 5;
        else if (leggings.getType() == Material.DIAMOND_LEGGINGS)
            rating += 6;
    }
    if (chest != null) {
        if (chest.getType() == Material.LEATHER_CHESTPLATE)
            rating += 3;
        else if (chest.getType() == Material.GOLDEN_CHESTPLATE)
            rating += 5;
        else if (chest.getType() == Material.CHAINMAIL_CHESTPLATE)
            rating += 5;
        else if (chest.getType() == Material.IRON_CHESTPLATE)
            rating += 6;
        else if (chest.getType() == Material.DIAMOND_CHESTPLATE)
            rating += 8;
    }
    return rating >= required.getInt(playerID);
}
 
Example 8
Source File: ExprArmorValue.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Nullable
public Number convert(Player evt) {
    Number armorValue = 0;
    // Check boots
    if (evt.getInventory().getBoots() != null) {
        if (evt.getInventory().getBoots().getType() == Material.LEATHER_BOOTS) {
            armorValue = armorValue.doubleValue() + 0.5;
        } else if (evt.getInventory().getBoots().getType() == Material.CHAINMAIL_BOOTS) {
            armorValue = armorValue.doubleValue() + 0.5;
        } else if (evt.getInventory().getBoots().getType() == Material.IRON_BOOTS) {
            armorValue = armorValue.doubleValue() + 1;
        } else if (evt.getInventory().getBoots().getType() == Material.GOLD_BOOTS) {
            armorValue = armorValue.doubleValue() + 0.5;
        } else if (evt.getInventory().getBoots().getType() == Material.DIAMOND_BOOTS) {
            armorValue = armorValue.doubleValue() + 1.5;
        }
    }
    // Check legs
    if (evt.getInventory().getLeggings() != null) {
        if (evt.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS) {
            armorValue = armorValue.doubleValue() + 1;
        } else if (evt.getInventory().getLeggings().getType() == Material.CHAINMAIL_LEGGINGS) {
            armorValue = armorValue.doubleValue() + 2;
        } else if (evt.getInventory().getLeggings().getType() == Material.IRON_LEGGINGS) {
            armorValue = armorValue.doubleValue() + 2.5;
        } else if (evt.getInventory().getLeggings().getType() == Material.GOLD_LEGGINGS) {
            armorValue = armorValue.doubleValue() + 1.5;
        } else if (evt.getInventory().getLeggings().getType() == Material.DIAMOND_LEGGINGS) {
            armorValue = armorValue.doubleValue() + 3;
        }
    }
    // Check chest plate
    if (evt.getInventory().getChestplate() != null) {
        if (evt.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE) {
            armorValue = armorValue.doubleValue() + 1.5;
        } else if (evt.getInventory().getChestplate().getType() == Material.CHAINMAIL_CHESTPLATE) {
            armorValue = armorValue.doubleValue() + 2.5;
        } else if (evt.getInventory().getChestplate().getType() == Material.IRON_CHESTPLATE) {
            armorValue = armorValue.doubleValue() + 3;
        } else if (evt.getInventory().getChestplate().getType() == Material.GOLD_CHESTPLATE) {
            armorValue = armorValue.doubleValue() + 2.5;
        } else if (evt.getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE) {
            armorValue = armorValue.doubleValue() + 4;
        }
    }
    // Check helm
    if (evt.getInventory().getHelmet() != null) {
        if (evt.getInventory().getHelmet().getType() == Material.LEATHER_HELMET) {
            armorValue = armorValue.doubleValue() + 0.5;
        } else if (evt.getInventory().getHelmet().getType() == Material.CHAINMAIL_HELMET) {
            armorValue = armorValue.doubleValue() + 1;
        } else if (evt.getInventory().getHelmet().getType() == Material.IRON_HELMET) {
            armorValue = armorValue.doubleValue() + 1;
        } else if (evt.getInventory().getHelmet().getType() == Material.GOLD_HELMET) {
            armorValue = armorValue.doubleValue() + 1;
        } else if (evt.getInventory().getHelmet().getType() == Material.DIAMOND_HELMET) {
            armorValue = armorValue.doubleValue() + 1.5;
        }
    }
    return armorValue;
}
 
Example 9
Source File: AcidEffect.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param player
 * @return A double between 0.0 and 0.80 that reflects how much armor the
 *         player has on. The higher the value, the more protection they
 *         have.
 */
static public double getDamageReduced(Player player) {
    org.bukkit.inventory.PlayerInventory inv = player.getInventory();
    ItemStack boots = inv.getBoots();
    ItemStack helmet = inv.getHelmet();
    ItemStack chest = inv.getChestplate();
    ItemStack pants = inv.getLeggings();
    double red = 0.0;
    if (helmet != null) {
        if (helmet.getType() == Material.LEATHER_HELMET)
            red = red + 0.04;
        else if (helmet.getType() == Material.GOLD_HELMET)
            red = red + 0.08;
        else if (helmet.getType() == Material.CHAINMAIL_HELMET)
            red = red + 0.08;
        else if (helmet.getType() == Material.IRON_HELMET)
            red = red + 0.08;
        else if (helmet.getType() == Material.DIAMOND_HELMET)
            red = red + 0.12;
    }
    if (boots != null) {
        if (boots.getType() == Material.LEATHER_BOOTS)
            red = red + 0.04;
        else if (boots.getType() == Material.GOLD_BOOTS)
            red = red + 0.04;
        else if (boots.getType() == Material.CHAINMAIL_BOOTS)
            red = red + 0.04;
        else if (boots.getType() == Material.IRON_BOOTS)
            red = red + 0.08;
        else if (boots.getType() == Material.DIAMOND_BOOTS)
            red = red + 0.12;
    }
    // Pants
    if (pants != null) {
        if (pants.getType() == Material.LEATHER_LEGGINGS)
            red = red + 0.08;
        else if (pants.getType() == Material.GOLD_LEGGINGS)
            red = red + 0.12;
        else if (pants.getType() == Material.CHAINMAIL_LEGGINGS)
            red = red + 0.16;
        else if (pants.getType() == Material.IRON_LEGGINGS)
            red = red + 0.20;
        else if (pants.getType() == Material.DIAMOND_LEGGINGS)
            red = red + 0.24;
    }
    // Chest plate
    if (chest != null) {
        if (chest.getType() == Material.LEATHER_CHESTPLATE)
            red = red + 0.12;
        else if (chest.getType() == Material.GOLD_CHESTPLATE)
            red = red + 0.20;
        else if (chest.getType() == Material.CHAINMAIL_CHESTPLATE)
            red = red + 0.20;
        else if (chest.getType() == Material.IRON_CHESTPLATE)
            red = red + 0.24;
        else if (chest.getType() == Material.DIAMOND_CHESTPLATE)
            red = red + 0.32;
    }
    return red;
}
 
Example 10
Source File: DeprecatedMethodUtil.java    From PerWorldInventory with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Test
 *
 * @param material
 * @return True if the given material is Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE,
 * Material.LEATHER_LEGGINGS, or  Material.LEATHER_BOOTS;
 */
public static boolean isLeatherArmor(Material material) {
    return material == Material.LEATHER_HELMET || material == Material.LEATHER_CHESTPLATE ||
            material == Material.LEATHER_LEGGINGS || material == Material.LEATHER_BOOTS;
}
 
Example 11
Source File: DeprecatedMethodUtil.java    From PerWorldInventory with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Test
 *
 * @param material
 * @return True if the given material is Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE,
 * Material.LEATHER_LEGGINGS, or  Material.LEATHER_BOOTS;
 */
public static boolean isLeatherArmor(Material material) {
    return material == Material.LEATHER_HELMET || material == Material.LEATHER_CHESTPLATE ||
            material == Material.LEATHER_LEGGINGS || material == Material.LEATHER_BOOTS;
}