Solved Custom things for certain players

Discussion in 'Plugin Development' started by Ula492, Jun 25, 2016.

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

    Ula492

    So I want to set custom lores for an item, and only certain players with certain ranks can see that lore and the same method will happen when the player clicks on the item, ive tried seeing if the player has the perm with p.hasPerm and user.has because of pex

    but here is my code for the right click:
    Code:
     if(user.has("water.reward")){
                    p.sendMessage(" §7 §m-------------------------------------------------§r ");
                    p.sendMessage("   §f§lYou have redeemed your monthly reward and received \n" +
                            "   the following:");
                    p.sendMessage("    §f§l• §a§l1 Rare Crate Keys");
                    p.sendMessage("    §f§l• §a§l2 Uncommon Crate Keys");
                    p.sendMessage("    §f§l• §a§l$1,000 In-Game Money");
                    p.sendMessage(" §7 §m-------------------------------------------------§r ");
                }else{
                    p.closeInventory();
                    p.sendMessage(" §7 §m-------------------------------------------------§r ");
                    p.sendMessage("   §f§lTo get a special crate from the me");
                    p.sendMessage("   §f§lyou must have §b§lWATER §f§lrank");
                    p.sendMessage(" §7 §m-------------------------------------------------§r ");
                }

    and here is the code for the lore:

    Code:
    ArrayList<String> MonthlyLore = new ArrayList<String>();
            if(p.hasPermission("Water.reward")){
                MonthlyLore.add("");
                MonthlyLore.add("§8§lEvery Month you will Receive the following:");
                MonthlyLore.add("    §f§l• §a§l1 Rare Crate Keys");
                MonthlyLore.add("    §f§l• §a§l2 Uncommon Crate Keys");
                MonthlyLore.add("    §f§l• §a§l$1,000 In-Game Money");
                MonthlyLore.add("Rank:");
                MonthlyLore.add("    §f§l• §b§lWATER");
                MonthlyLore.add("");
            }else{
                MonthlyLore.add("");
                MonthlyLore.add("§f§lTo get a special crate from the villager");
                MonthlyLore.add("§f§lyou must have §b§lWATER §f§lrank");
                MonthlyLore.add("");
            }
    The problem is, it sends the player all msgs (Not the "else" messages) and shows all lores.
     
  2. Offline

    Zombie_Striker

    @Ula492
    Do you know if the player has that exact permission? For one permission, you are checking for Water.reward, while the other is checking for water.reward. Case is important. Also, are you sure you are re-setting the itemstack's lore and re-adding the item to the inventory?
     
  3. Offline

    Ula492

    Its not case sensitive. Tried. But player does have exact perm. I took off OP from plugin.yml for the perm and it still doesnt work. Shows all lores and messages.
     
  4. Offline

    Sinnska

    By the way you can use "\n" for the messages in the chat
    If it's solved, tell us how you did it.
     
  5. Offline

    Ula492

    I just used else if since I have more then 3 lores. I comepletly blanked out and didn't think about using it.
     
Thread Status:
Not open for further replies.

Share This Page