nrubin29

LeatherRecipe.java

Aug 6th, 2013
2,284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1. package me.pogostick29.leatherrecipe;
  2.  
  3. import java.util.Arrays;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Color;
  8. import org.bukkit.Material;
  9. import org.bukkit.inventory.ItemStack;
  10. import org.bukkit.inventory.ShapedRecipe;
  11. import org.bukkit.inventory.ShapelessRecipe;
  12. import org.bukkit.inventory.meta.LeatherArmorMeta;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class LeatherRecipe extends JavaPlugin {
  16.  
  17.     public void onEnable() {
  18.         hrecipe();
  19.         precipe();
  20.     }
  21.    
  22.     private void hrecipe() {
  23.         ItemStack helmet = new ItemStack(Material.LEATHER_HELMET, 1);
  24.         LeatherArmorMeta meta = (LeatherArmorMeta) helmet.getItemMeta();
  25.         meta.setDisplayName(ChatColor.GRAY + "Special Helmet");
  26.         meta.setLore(Arrays.asList("This helmet", "is very special", "Use it wisely."));
  27.         meta.setColor(Color.LIME);
  28.         helmet.setItemMeta(meta);
  29.        
  30.         ShapedRecipe hrecipe = new ShapedRecipe(helmet);
  31.         hrecipe.shape(
  32.                 "@@@",
  33.                 "@ @");
  34.         hrecipe.setIngredient('@', Material.IRON_BLOCK);
  35.         Bukkit.getServer().addRecipe(hrecipe);
  36.     }
  37.    
  38.     private void precipe() {
  39.         ItemStack plate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  40.         LeatherArmorMeta meta2 = (LeatherArmorMeta) plate.getItemMeta();
  41.         meta2.setDisplayName(ChatColor.GRAY + "Special Chestplate");
  42.         meta2.setLore(Arrays.asList("This chestplate", "is very special", "Use it wisely."));
  43.         meta2.setColor(Color.AQUA);
  44.         plate.setItemMeta(meta2);
  45.        
  46.         ShapelessRecipe precipe = new ShapelessRecipe(plate);
  47.         precipe.addIngredient(6, Material.IRON_BLOCK);
  48.         precipe.addIngredient(2, Material.APPLE);
  49.         Bukkit.getServer().addRecipe(precipe);
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment