Craft Event

Discussion in 'Plugin Development' started by thepluginbros, Dec 14, 2013.

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

    thepluginbros

    Hi guys,
    I have an problem with an project I'm working on!
    I want it to make if you craft and chest with an custom crafing recipi that you get an chest with the name who crafts the item!

    My code does'nt work!
    My code:
    Code:java
    1. @EventHandler
    2. public void onChestCreat(CraftItemEvent event){
    3. ItemStack chest = new ItemStack(Material.CHEST, 8);
    4. ItemMeta im = chest.getItemMeta();
    5. im.setDisplayName("" + event.getWhoClicked());
    6. chest.setItemMeta(im);
    7. ShapedRecipe chests = new ShapedRecipe(chest);
    8. chests.shape(new String[] { "SSS", "SIS", "SSS" });
    9. chests.setIngredient('S', Material.STRING);
    10. chests.setIngredient('I', Material.CHEST ); getServer().addRecipe(chests);
    11.  
    12. event.getWhoClicked().getInventory().addItem(chest) ;
    13. }


    I hope someone can help me out!
     
  2. Offline

    spookyDHD

    is this what you mean?

    link to youtube:
     
  3. Offline

    thepluginbros

    No, I want to get the player who crafts the item!
     
  4. Offline

    MrDynamo

    @thepluginbros

    Elaborate more please
     
  5. Offline

    thepluginbros

    If you craft: and chest in the middle and string around it you will get an chest with the name who crafts it!
     
  6. Offline

    MrDynamo

    @thepluginbros

    So the players name is the name of the crafted chest?
     
  7. Offline

    thepluginbros

    yes, if my playername is "plugin" and I craft the chest the name off the chest will be "plugin"
     
Thread Status:
Not open for further replies.

Share This Page