Gives a player a colourd stained clay.

Discussion in 'Plugin Development' started by DSCxSander, Oct 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    DSCxSander

    How do i give a player an colourd stained clay?

    My code for so long:

    Code:java
    1. public static ItemStack MTON(){
    2. ItemStack m = new ItemStack(Material.STAINED_CLAY);
    3.  
    4. ItemMeta mm = m.getItemMeta();
    5.  
    6. mm.setDisplayName(ChatColor.GRAY + "Mine Train");
    7.  
    8. ArrayList<String> lore = new ArrayList<String>();
    9. lore.add(ChatColor.GOLD + " Onderhoud");
    10.  
    11. mm.setLore(lore);
    12. m.setItemMeta(mm);
    13. return m;
    14. }
     
  2. Offline

    SleepyDog

    If this helps:
    You could pick it apart and modify it.
    Code:java
    1. public void onPlayerJoin(PlayerJoinEvent evt) {
    2. Player player = evt.getPlayer(); // The player who joined
    3. PlayerInventory inventory = player.getInventory(); // The player's inventory
    4. ItemStack itemstack = new ItemStack(Material.DIAMOND, 64); // A stack of diamonds
    5.  
    6. if (inventory.contains(itemstack)) {
    7. inventory.addItem(itemstack); // Adds a stack of diamonds to the player's inventory
    8. player.sendMessage("Welcome! You seem to be reeeally rich, so we gave you some more diamonds!");
    9. }
    10. }
     
  3. Offline

    Dudemister1999

    DSCxSander

    Code:java
    1.  
    2. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)0) //White
    3. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)1) //Orange
    4. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)2) //Magenta
    5. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)3) //Light Blue
    6. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)4) //Yellow
    7. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)5) //Lime
    8. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)6) //Pink
    9. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)7) //Gray
    10. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)8) //Light Gray
    11. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)9) //Cyan
    12. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)10) //Purple (My favourite)
    13. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)11) //Blue
    14. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)12) //Brown
    15. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)13) //Green
    16. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)14) //Red
    17. ItemStack m = new ItemStack(Material.STAINED_CLAY, amount, (byte)15) //Black
    18.  
     
    xYourFreindx likes this.
  4. Offline

    Gater12

    DSCxSander
    You can also use the DyeColor enum and get the dye data (getDyeData).
     
    Dudemister1999 and xYourFreindx like this.
  5. Offline

    DSCxSander

Thread Status:
Not open for further replies.

Share This Page