Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.List;
- import org.bukkit.Material;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.inventory.meta.SkullMeta;
- import org.bukkit.potion.Potion;
- import org.bukkit.potion.PotionType;
- @SuppressWarnings("deprecation")
- public class ItemUtils {
- /* Creation d'items */
- public ItemStack getItem(Material material, int amount) {
- return new ItemStack(material, amount);
- }
- public ItemStack getItem(Material material, int amount, String name) {
- ItemStack itemstack = new ItemStack(material, amount);
- ItemMeta itemmeta = itemstack.getItemMeta();
- itemmeta.setDisplayName(name);
- itemstack.setItemMeta(itemmeta);
- return itemstack;
- }
- public ItemStack getItem(Material material, int amount, String name, List<String> lore) {
- ItemStack itemstack = new ItemStack(material, amount);
- ItemMeta itemmeta = itemstack.getItemMeta();
- itemmeta.setDisplayName(name);
- itemmeta.setLore(lore);
- itemstack.setItemMeta(itemmeta);
- return itemstack;
- }
- public ItemStack getItem(Material material, int amount, String name, List<String> lore, Enchantment echant, int puissance, boolean voala) {
- ItemStack itemstack = new ItemStack(material, amount);
- ItemMeta itemmeta = itemstack.getItemMeta();
- itemmeta.setDisplayName(name);
- itemmeta.setLore(lore);
- itemmeta.addEnchant(echant, puissance, voala);
- itemstack.setItemMeta(itemmeta);
- return itemstack;
- }
- /* Creation de GLASS PANE */
- public ItemStack getGlassPane(int color) {
- ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) color);
- ItemMeta glassM = glass.getItemMeta();
- glassM.setDisplayName(" ");
- glass.setItemMeta(glassM);
- return glass;
- }
- public ItemStack getGlassPane(int color, String name) {
- ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) color);
- ItemMeta glassM = glass.getItemMeta();
- glassM.setDisplayName(name);
- glass.setItemMeta(glassM);
- return glass;
- }
- /* Creation de POTIONS */
- public ItemStack getPotion(PotionType effet) {
- Potion potion = new Potion(effet);
- return potion.toItemStack(1);
- }
- public ItemStack getPotion(PotionType effet, int amount) {
- Potion potion = new Potion(effet);
- return potion.toItemStack(amount);
- }
- /* Creation de SKULLS */
- public ItemStack getSkull(Player player) {
- ItemStack customSkull = new ItemStack(Material.SKULL, 1, (byte) 3);
- ItemMeta customSkullMeta = customSkull.getItemMeta();
- customSkullMeta.setDisplayName(player.getCustomName());
- customSkull.setItemMeta(customSkullMeta);
- SkullMeta customSkullMeta2 = (SkullMeta) customSkull.getItemMeta();
- customSkullMeta2.setOwner(player.getName());
- customSkull.setItemMeta(customSkullMeta2);
- return customSkull;
- }
- public ItemStack getSkull(Player player, String nom) {
- ItemStack customSkull = new ItemStack(Material.SKULL, 1, (byte) 3);
- ItemMeta customSkullMeta = customSkull.getItemMeta();
- customSkullMeta.setDisplayName(nom);
- customSkull.setItemMeta(customSkullMeta);
- SkullMeta customSkullMeta2 = (SkullMeta) customSkull.getItemMeta();
- customSkullMeta2.setOwner(player.getName());
- customSkull.setItemMeta(customSkullMeta2);
- return customSkull;
- }
- public ItemStack getSkull(Player player, String nom, List<String> lore) {
- ItemStack customSkull = new ItemStack(Material.SKULL, 1, (byte) 3);
- ItemMeta customSkullMeta = customSkull.getItemMeta();
- customSkullMeta.setDisplayName(nom);
- customSkullMeta.setLore(lore);
- customSkull.setItemMeta(customSkullMeta);
- SkullMeta customSkullMeta2 = (SkullMeta) customSkull.getItemMeta();
- customSkullMeta2.setOwner(player.getName());
- customSkull.setItemMeta(customSkullMeta2);
- return customSkull;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement