Editable book

Discussion in 'Plugin Development' started by Yaron_1231, Jun 13, 2015.

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

    Yaron_1231

    Hi
    I am making a plugin that allows players to make staff application.
    I want them to be able to write the application in books.
    The problem is that they cant type.
    I looked for this problem but couldn't find anything but using BookMeta instead of ItemMeta.
    It still gives the same error: Invalid Item Meta.
    Code:
    Code:
    ItemStack book=new ItemStack(Material.BOOK_AND_QUILL,1);
                BookMeta meta=(BookMeta)book.getItemMeta();
                if(rank.equalsIgnoreCase("admin")){
                    meta.setDisplayName("§aApply for: §c§lAdmin");
                }else if(rank.equalsIgnoreCase("headadmin")){
                    meta.setDisplayName("§aApply for: §4§lHead-Admin");
                }else if(rank.equalsIgnoreCase("headbuilder")){
                    meta.setDisplayName("§aApply for: §2§lHead-Builder");
                }else if(rank.equalsIgnoreCase("builder")){
                    meta.setDisplayName("§aApply for: §5§lBuilder");
                }else if(rank.equalsIgnoreCase("headhelper")){
                    meta.setDisplayName("§aApply for: §9§lHead-Helper");
                }else if(rank.equalsIgnoreCase("helper")){
                    meta.setDisplayName("§aApply for: §a§lHelper");
                }else if(rank.equalsIgnoreCase("developer")){
                    meta.setDisplayName("§aApply for: §1§lDeveloper");
                    p.sendMessage("§cou need to know Java to be a developer!");
                }else {
                    p.sendMessage("§cUnavailable rank!");
                    return true;
                }
                p.sendMessage("§2Make sure to include your in game name!");
                p.sendMessage("§2When you are done dont sign, just punch the air\nwith the application in hand.");
                book.setItemMeta(meta);
                p.getInventory().addItem(book);
                return true;


    ------------------------------------------------------------
    The code is in the onCommand Function.
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    Zombie_Striker

    @Yaron_1231
    Sadly, there error comes from the fact that the displayname must not be changed in order for the books to be editable. All you need is to remove the display names and it would work (A work around to get what you want would be to instead of setting the displayname, you would set the lore).
     
  4. Offline

    Yaron_1231

    Thanks!!!!

    I tried it, it still doesn't work... :(

    Ok i did something else so im good on the plugin, but still It would be nice to know a way to go around this bug.

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Jun 17, 2015
Thread Status:
Not open for further replies.

Share This Page