Filled RedeemPerks

Discussion in 'Plugin Requests' started by AlwaysAllstar, Feb 4, 2020.

  1. Offline

    AlwaysAllstar

    Plugin category: Perks

    Minecraft version: 1.14

    Suggested name: RedeemPerks

    What I want: A plugin where you can run commands upon a player redeeming a perk by holding and right clicking an item. I thought I'd be able to find a plugin like this pretty easily, but I haven't been able to find any. If you know of one let me know please!

    Config:

    Item: <What item the perks are displayed as (Like a book)>

    Perks:
    <Perk name>:
    Name: <Item in game display name with this perk>
    Lore:
    - <Lore of item with this perk>
    - <Lore of item with this perk>
    - <Lore of item with this perk>
    Command:
    - <Command>
    - <Command>
    - <Command>
    <Perk name>:
    Name: <Item in game display name with this perk>
    Lore:
    - <Lore of item with this perk>
    - <Lore of item with this perk>
    - <Lore of item with this perk>
    Command:
    - <Command>
    - <Command>
    - <Command>

    Lang:
    Prefix: <Prefix>
    Redeem: <Message shown to player when they redeem a perk>

    Please add color support and placeholders like <user> and <perk>.
    <User> - To use in commands for something like 'give <user> 1 diamond'
    <Perk> - To use in the redeem message for something like 'You redeemed the <perk>!' (Should show the display name used on the item, not the name of the perk in the config)

    EDIT: I edited the config to show what I meant by having the lore be multiple times as I said in one of my replies.

    Ideas for commands: /perk get <Perk Name> - For an owner/admin to actually receive the item in game.

    Ideas for permissions: perk.get - Allows command above; anyone will be able to redeem any perk

    When I'd like it by: As soon as possible :)
     
    Last edited: Feb 16, 2020
  2. Offline

    AlwaysAllstar

  3. Offline

    InstanceofDeath

    I have created your plugin-wish in about 2 hours. Even small plugins require bugtesting and cleaning-up code.
    There are some things I want you to remember before tooling around with it (That is why I provided an example config.yml that should help you create your own (Best would be to just modify this one).

    Java is case-sensitive in every context, so you have to write Item,Perks,Lang,Prefix,Redeem,Name,Lore,Commands in the way they are in the example. Also, the spacing has to be the exact same (4 spacebars and one for the command list)

    <User> can only be used in commands and has to be written this exact same way.
    <Perk> can only be used in the message and has to be written this exact same way

    Coloring can be accessed via using § and then a specific symbol -> https://minecraft.gamepedia.com/Formatting_codes

    It is recommended to toggle of command feedback, because the command gets executed by the console and due to that creates a message in chat [/gamerule sendCommandFeedback false]

    https://www.dropbox.com/s/kr3cnjc569ff0dx/RedeemPerks.jar?dl=0

    the config.yml has to be named this way and has to be in the folder plugins/RedeemPerks/config.yml
    https://www.dropbox.com/s/916tir497drnxvg/config.yml?dl=0

    have fun. please reply if you found any bugs. have a good day

    P.S. Sorry for bad english :Y
     
  4. Offline

    AlwaysAllstar

    Hi, thank you so much @InstanceofDeath . What's the command to receive the book/perk item in game so players can actually redeem it? /perk get <name> doesn't seem to be working.
     
  5. Offline

    InstanceofDeath

    I changed it to /getperk <perk> because it is easier to programm commands with less arguments and there was no need for the spacebar ;)
     
  6. Offline

    AlwaysAllstar

    @InstanceofDeath

    It's working perfectly! The only thing is I was wondering if you could change it so the lore can be multiple lines. Something like

    Lores:
    - Lore 1
    - Lore 2

    Similar to the commands layout, so I can describe what the perk is on one or two lines and then put 'Right Click to Redeem' or something like that on the third line.

    (Or you could add in \n to go to the next line)
     
    Last edited: Feb 10, 2020
  7. Offline

    InstanceofDeath

  8. Offline

    AlwaysAllstar

    Hey, the new lore system seems to be working great but I have discovered a bug. I added the plugin and config and made a perk called diamond where a player will receive one diamond as a test and it worked great. I then added another perk to set a players permission group using my permission plugin (LuckPerms). Now, whenever I do /getperk diamond or /getperk president it shows up 'This perk was not found!' Basically for some reason it isn't detecting either of the perks I made. This is my config:
    Code:
    Item: Book
    Lang:
        Prefix: §2Perks§7§l>>§r
        Redeem: §aYou have redeemed <Perk>§a!
    
    Perks:
        diamond:
            Name: §b§lDiamond §7§lPerk
            Lore:
            - §7Gives you one diamond!
            - §b§lRight Click §7to redeem!
            Commands:
                - give <User> diamond 1
        president:
            Name: §e§lPresident §7§lRank
            Lore:
            - §cGives player the president rank!
            - §bRight Click §7to redeem!
            Commands:
                - lp user <User> parent settrack ranks president
     
  9. Offline

    InstanceofDeath

  10. Offline

    AlwaysAllstar

    The bug is back.. I added in the same two perks as last time when the bug appeared and they worked just fine. But then I added in a total of 5 perks and the same bug came back. I thought maybe it was because I exceeded two perks so I removed three but the bug still continued... I also tried to replicate the first two perks that were working fine as best I could before the bug appeared but they no longer worked. Please figure out what is causing this bug and fix it?
     
    Last edited: Feb 12, 2020
  11. Offline

    AlwaysAllstar

    @InstanceofDeath are you working on a fix for the bug, or should I look into asking someone else to make this for me? This bug makes the plugin unusable so I can't really work around the bug..
     
  12. Offline

    AlwaysAllstar

    Does anyone else want to give this a try?..
     
  13. Offline

    EpicGodMC

    Hey @AlwaysAllstar i have created something that i think will fit your needs.

    i did make quite a few changes to the exact ideas you proposed above, i also added a log system
    if one of your players claims to have redeemed a perk without getting anything you can see exactly when and what perk was redeemed
    you can do this with "/perk logs <PlayerName>"

    the command you proposed to get yourself perks was a little limited as you would only be allowed to give yourself perks
    i have changed it to "/perk give <PlayerName> <PerkName>"

    the permission for all commands is "perks.admin"

    commands are also able to be executed from console

    this will be your Perks.yml where you create your perks every single thing shown here is needed on any new perks

    i will give a brief explaination on how each key/value works after each #
    Code:
    
    #General Key
    perks:
    #This is your PerkName which is used to spawn them in using the command
      example:
    #Displayname of the item
        displayName: "&4&lExamplePerk"
    #What item should be spawned in
        itemType: "BOOK"
    #Damage used for blocks like blue wool, for most items this will remain at 0
        damage: 0
    #Wether the item should glow e.g. Look enchanted
        glow: true
    #Deny node if the player trying to redeem the perk has this permission, he will be denied
        deny-node: "perk.diamond"
    #Deny/Success message, i put them here so you can add a custom message for each perk not just 1 universal message
        messages:
          success: "&aYou just redeemed this lit perk %player%"
          denied: "&cYou have already redeemed this perk!"
    #The Lore of the item
        lore:
          - '&1TestLine'
          - '&2TestLine'
          - '&3TestLine'
    #List of commands executed upon success
        commands:
          - 'give %PLAYER% diamond 1'
    
    Plugin is made in 1.14 and has not been tested in any other versions

    NOTE: my plugin requires NBT-API to work, without this plugin my plugin will NOT work, you can find it here


    If you want to take a look at the code and see how its all done, feel free to take a look right here

    You can find the download right here

    If you find any errors/buggs/issues you can either make a "issue" on github or contact me on bukkit
    hope this works for ya, cheers
     
  14. Offline

    AlwaysAllstar

    Working perfectly! Found no bugs. Thank you so much. :)
     
  15. Offline

    EpicGodMC

    not a problem, have fun with it :)
     

Share This Page