Solved BookMeta

Discussion in 'Plugin Development' started by RainoBoy97, Jan 24, 2013.

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

    RainoBoy97

    Im trying to make a book with info for a server (opening soon ;)) and i need the BookMeta, but i get a ClassCastException on
    Code:java
    1. BookMeta bm = (BookMeta) book.getItemMeta();


    the whole code snippet
    Code:java
    1. if(args[0].equalsIgnoreCase("rules")){
    2. ItemStack book = new ItemStack(340, 1);
    3. BookMeta bm = (BookMeta) book.getItemMeta();
    4. bm.setTitle(this.getConfig().getString("Rules.lore"));
    5. book.setItemMeta(bm);
    6.  
    7. player.getInventory().addItem(book);
    8. }


    So the problem is; I cant cast..

    Thanks for help :)
     
  2. Offline

    evilmidget38

    RainoBoy97 Use 387(written book) instead of 340 for your item ID.
     
    RainoBoy97 likes this.
  3. Offline

    RainoBoy97

    evilmidget38
    I tried that, but it didnt do anything. Now it works xD Thanks ;)
     
Thread Status:
Not open for further replies.

Share This Page