Set Amount

Discussion in 'Plugin Development' started by ItsMees, Nov 20, 2013.

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

    ItsMees

    Hi Guys,
    I have an problem with an project I'm working on!
    I want it to make that you have an sign with on the first line the text: [free] and on the second line an ItemID and on the thirth line the amount.
    The problem is that I can't set the amount!
    My Code:
    Code:java
    1. Block block = event.getClickedBlock();
    2.  
    3. switch(block.getType()) {
    4. case SIGN_POST:
    5. case WALL_SIGN:
    6. case SIGN:
    7. if(((Sign) block.getState()).getLine(0).equalsIgnoreCase("[free]")){
    8. ItemStack buy = new ItemStack(Material.getMaterial(Integer.parseInt(((Sign) block.getState()).getLine(1))));
    9. buy.setAmount((((Sign) block.getState()).getLine(2)));
    10. }
    11. break;
    12. default:
    13. break;
    14. }


    The problem:
    Code:java
    1. buy.setAmount((((Sign) block.getState()).getLine(2)));


    I hope someone can help me out!
    Bye
     
  2. Offline

    L33m4n123

    What exactly IS the problem?
     
  3. Offline

    ItsMees

    I try to set the amount to the thirt line of an sign but I don't no how to do that!
     
  4. Offline

    mattrick

    ItsMees
    You need to parse the string to an int.
    Code:
    Integer.parseInt(string)
     
Thread Status:
Not open for further replies.

Share This Page