[INACTIVE][ECON/FUN] BuyAbilities v0.8.9 - Purchase Abilities [740]

Discussion in 'Inactive/Unsupported Plugins' started by rcjrrjcr, Mar 31, 2011.

  1. Offline

    rcjrrjcr

    NEW THREAD

    BuyAbilities - Purchase Abilities:
    Version: v0.8.9

    BuyPermissions is a plugin that allows your players to purchase abilities or permissions with iConomy/EssentialsEco/BOSEconomy money! This way, players can finally have a long-term investment for their virtual money, instead of spending it on items. Also, the time-based and use-based rent systems allow temporary access to permissions.

    Abilities are groups of related permission nodes, which are granted to the player upon purchase. Abilities are also grouped into categories, which the server admins can deny or allow access to via permissions.

    Original Suggestion Thread
    Purchasable Permissions/Abilities

    Features:
    • Rent abilities for a specified duration
    • Purchase uses of an ability and its associated commands
    • Purchase abilities permanently and retain its benefits forever (theoretically:p)
    Download


    Help

    Source Code

    Requirements:
    • An economy plugin (iConomy 4, EssentialsEco, BOSEconomy)
    • A permissions plugin (Permissions 2.7, GroupManager)
    Usage Instructions:

    • Plugin commands are "/bab" and "/buyab". Each can be used instead of the other.
    • From player's chat:
      • "/bab categories" returns all accessible categories.
      • "/bab category <categoryname>" returns all abilities in the category.
      • "/bab page" lists all accessible abilities.
      • "/bab current" lists all active abilities.
      • "/bab buy <abilityname>" buys an ability.
      • "/bab rent <abilityname>" rents an ability for a period of time.
      • "/bab rentuse <abilityname>" purchases uses of an ability.
      • "/bab info <abilityname>" returns information about that ability.
      • "/bab help <abilityname>" returns the help text about that ability.
    • From server console:
      • "/bab listall" prints out a list of all active abilities for all players.
      • "/bab status" prints out the current status of the hooks into the permissions and economy plugins.
    • For admins:
      • To allow usage of the /bab command, grant the permission "buyabilities.use".
      • To allow access to a category, grant the permission "buyabilities.abilities.<categoryname>" where <categoryname> is the name of the category, with periods replacing spaces.
      • NOTE: A user can access an ability if he can access any single one of its categories. It does not matter if he can access its other categories, just one.
    • NOTE: If an ability or category name is misspelled, this plugin will provide suggestions for the correct spelling of the name.
    Changelog:
    Version 0.8.9
    • Fixes ability removal bug. Iterators finally get a use.
    Show Spoiler
    Show Spoiler


    Version 0.8.8
    • Update for CB 740.
    Version 0.8.7
    • ?
    Version 0.8.6
    • Fixed regex matching whole string bug
    Version 0.8.5

    • Fixed bugs because of Permissions caching old permissions.
    Version 0.8.4

    • Fixed NPE when saving player data
    • Fixed permissions bug
    • Added BOSEconomy support.
    Version 0.8.3

    • Fixed data.yml not being created.
    Version 0.8.2

    • Removed interfering code from another git branch.
    Version 0.8.1

    • Fixed cost data not loading.
    Version 0.8

    • Auto-loading and auto-saving of player data during join/quit events.
    Version 0.7.3


    • General fixes.
    Version 0.7.2


    • Recompile for CB 617.
    Version 0.7.1


    • Recompile for CB 602.
    Version 0.7


    • Added suggestions for ability/category names in case it is misspelled.
    Version 0.6


    • Added usage counters.
    Version 0.5.6


    • Changed package names to conform to Java's naming conventions.
    Version 0.5.5


    • Minor optimisations.
    Version 0.5.4


    • Abilities can belong to multiple categories.
    Version 0.5.3


    • Fixed another NPE due to FakePermissions confusing the plugin.
    • Added permissions to use /bab.
    • Changed category permission format.
    Version 0.5.2


    • Fixed actual cause behind NPE.
    Version 0.5.1


    • Fixed NPE bug when hooking into economy.
    Version 0.5


    • First release. Permissions unsupported though.
    Version 0.01


    • First announced version. Not working yet.



    TODO
    1. FIX ALL BUGS
    2. Better and easier implementation of ranks
      • Add requirements for rank advances
    3. Graphical editor for costs.yml
    4. Scripts for activation/deactivation.
    Suggestions and ideas are welcome!


    Credits:

    I would like to credit the people whose code I used:

    Report bugs by enclosing the exception's stack trace, your costs.yml and data.yml in spoilers.
     
  2. Offline

    rcjrrjcr

    Thanks. It was a simple matter to create an interface for it and load it.

    It only allows you to buy it permanently, not just only uses of it? Did you leave out the associated commands?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  3. Offline

    darkwarriors

    Code:
    Abilities:
        Toolkit:
          # This name is how the plugin refers to the purchaseable ability internally. It's used in the file described in 2.
            info:
                name: 'tool Kit'
                description: 'buy toll kit'
                help: 'use /kit tool'
            # name/description listed in game/ability inventory. changing the name here would not break the association to users that have bought it.
            permissions:
                - 'essentials.kit.tools'
            # all permission nodes the user would gain access to.
            categories:
                - 'movement'
            # used to organize/filter abilities
            #commands:
            # - 'RGX=(?i)/j(ump)?'
            # java regex used to check for associated commands
            costs:
                use:
                    cost: 10
                    usecount: 4
                  # use-based ownership of that permission
        MailSend:
            info:
                name: 'Mail send'
                description: 'Spedire email ai player offline'
                help: 'basta fare /mail send player messaggi'
            permissions:
                - 'essentials.mail.send'
            categories:
                - 'movement'
            costs:
                buy:
                    cost: 10
                rent:
                    cost: 10
                    duration: 30
        Wolf Vendor:
            info:
                name: 'Wolf Vendor'
                description: 'ti permetti di vendere wolf'
                help: 'Leggi il forum per sapere come funziona!'
            permissions:
                - 'wolfpound.create'
            categories:
                - 'movement'
            costs:
                buy:
                    cost: 1000
                rent:
                    cost: 50
                    duration: 30
    
    i try every combination of config file, i realized that:
    i can only buy MailSend, both rent and rent use say impossibile to rent/rentuse this abilities, even if i bought an abilities it displays that i have bought an abilities but data.yml still empty, and the permission dont work still say u have enaught permissions to send mail!
    I cant use Wolf Vendor beacuse of space.
     
  4. Offline

    rcjrrjcr

    Uses of MailSend cannot bought as the associated commands are not specified and there is no "use" entry in "costs". Ability names with spaces will be fixed in the next release.

    However, the rent option for MailSend looks perfectly fine. Can you try "/bab info MailSend" and tell me what it prints out?
     
  5. Offline

    darkwarriors

    my data.yml
    Code:
    Data:
        darktest:
            world:
                MailSend:
                    duration: 0
                    nodes:
                      - essentials.mail.send
                    type: BUY
                Toolkit:
                    duration: 0
                    nodes:
                      - essentials.kit.tools
                    type: BUY
    
    permissions hook doesnt work, if i put in permissions plugin this permissions all work fine but buying it with BuyAbilities when i do /kit tools or /mail send ... this is output:

    http://imagestorming.com/media/hwh/1302427026/2011-04-10_11.12.57.png

    if u need something else tell me i can give ll u need for better fixing this uses.
    ok in image i do also /bab info MailSend
     
  6. Offline

    BioRage

    Is it possible to have restrictions?

    IE:
    Permissions Names:
    Defualt:
    Citizen:
    Pickachu:

    3 Different Groups,

    But Default can only BAB "X"
    Citizen can only BAB "Y"
    Pickachu can only BAB "Z"

    Or is it set to be, Default, citizen, etc. to buy XYZ no matter your pre-defined groups.
     
  7. Offline

    rcjrrjcr

    Seems like this plugin was broken by Permissions 2.6. Ironic since those changes in the code were from my pull request. I'll check what went wrong.
     
  8. Offline

    darkwarriors

    i use this version of permission plugin 11:41:02 [INFO] [Permissions] version [2.5.5] (Phoenix) loaded
     
  9. Offline

    rcjrrjcr

    :pI just realised that Permissions used a cache and would preserve the old state of the permission. One problem fixed. However, the "Unable to buy uses of this ability" problem doesn't seem to be reproducible. I can buy uses of abilities perfectly fine.
     
  10. Offline

    darkwarriors

    mmm so is better to wait an your update or i have to update my plugin's permission?
    if u want to try some thing on my test server i can give u teamwiever access!
     
  11. Offline

    rcjrrjcr

    Update is nearly done. Just fixing up some loading bugs.

    Version 0.8.5 released. Fixed permission caching bugs.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  12. Offline

    darkwarriors

    Great all hook permissions now works but rentuse still bugged it doesnt display the price and count and dont work when type command /bab rentuse Toolkit

    Code:
    Abilities:
        Toolkit:
          # This name is how the plugin refers to the purchaseable ability internally. It's used in the file described in 2.
            info:
                name: 'tool Kit'
                description: 'buy toll kit'
                help: 'use /kit tool'
            # name/description listed in game/ability inventory. changing the name here would not break the association to users that have bought it.
            permissions:
                - 'essentials.kit.tools'
            # all permission nodes the user would gain access to.
            categories:
                - 'movement'
            # used to organize/filter abilities
            #commands:
            # - 'RGX=(?i)/j(ump)?'
            # java regex used to check for associated commands
            costs:
                buy:
                    cost: 10
                rent:
                    cost: 10
                    duration: 30
                use:
                    cost: 10
                    usecount: 4
                # use-based ownership of that permission
    
    http://imagestorming.com/media/xir/1302450722/2011-04-10_17.51.05.png
     
  13. Offline

    darkwarriors

    i noticed that if i replaced costs.yml with wichone that there is in zip file all works fine, maybe depend on same space that dont corrispond the parsing of the file!

    but..

    Code:
    Data:
        darktest:
            world:
                Jump:
                    duration: 5
                    nodes:
                    - essentials.jump
                    type: USE
    
    i use command /bab rentuse Jump but i can use /jump command for every time i want.. what does it mean duration:5 in data.yml and usecount:5 in costs.yml?

    and duration in costs.yml like 4000 it is second? or minecraft time?
     
  14. Offline

    rcjrrjcr

    For abilities of type USE, duration represents the amount of uses left. For abilities of type RENT, duration represents the time left in server ticks (1 tick is 1/20s, 20ticks = 1 second). For BUY, duration should be 0.
     
  15. Offline

    darkwarriors

    ok so duration for rentuse doesnt work.. i test with yours default costs.yml file in the zip, and i have type /jump command like 50timess and never left the permissions in data.yml!
     
  16. Offline

    rcjrrjcr

    ???
    Are you sure you didn't edit costs.yml?

    EDIT: Found your problem. Going to fix it.
     
  17. Offline

    darkwarriors

    yes i unzipped yours file and start the server np change in config file!

    Code:
    Abilities:
        Jump:
          # This name is how the plugin refers to the purchaseable ability internally. It's used in the file described in 2.
            info:
                name: 'jump to aim'
                description: 'allows user to jump to a block you are looking at'
                help: 'To jump type /jump or /j'
            # name/description listed in game/ability inventory. changing the name here would not break the association to users that have bought it.
            permissions:
                - 'essentials.jump'
            # all permission nodes the user would gain access to.
            categories:
                - 'movement'
            # used to organize/filter abilities
            commands:
                - 'RGX=(?i)/j(ump)?'
            # java regex used to check for associated commands
            costs:
                buy:
                    cost: 10000
              # permanent ownership of that permission
                rent:
                    cost: 100
                    duration: 30000
                  # time-based ownership of that permission
                use:
                    cost: 50
                    usecount: 5
                  # use-based ownership of that permission
        HealChest:
            info:
                name: 'use heal chests'
                description: 'allows you to use healing chests'
                help: 'Find a chest with a sign that says [heal]. then right click it.'
            permissions:
                - 'essentials.signs.protection.use'
            categories:
                - 'combat'
            costs:
                buy:
                    cost: 10000
                rent:
                    cost: 1000
                    duration: 3000
        SetHome:
            info:
                name: 'Home'
                description: 'Allows you to set and change your home'
                help: 'Type /setHome to create your home and /home to access it.'
            permissions:
                - 'essentials.sethome'
            categories:
                - 'basic'
            costs:
                buy:
                    cost: 1000
                rent:
                    cost: 100
                    duration: 5000
    
    durtion for rent works well also buy, but rentuse i can use that command every time i want. tested alot of time.
     
  18. Offline

    rcjrrjcr

    No, it's not your fault. I accidentally required the regex to match the entire string, which fails if you use "/jump <somethinghere>", and so doesn't consume a use. For v0.8.6, just remove the "(?i)" part of the command regex. It's automatically added. Going to test it now.

    Version 0.8.6 released. Fixes regex bug.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  19. Offline

    haldavid

    So 6000 ticks should be five minutes? The timer seems wonky, it was telling me I had 876s left at one point, which is around 3 times the five minutes I wanted.

    I set it up to rent an ability for 6000 ticks, using "bab listall" in console it said 300s left, which was perfect. I watched it count down...but after the 5 minutes was up, I could still use the ability.

    costs.yml

    Abilities:
    bone:
    info:
    name: 'use bone teleport'
    description: 'Allows you to use bone teleport for five minutes.'
    help: 'Type /tp mover to get a bone to use.'
    permissions:
    - 'tpp.mod.mover'
    categories:
    - 'utility'
    costs:
    buy:
    cost: 250000
    rent:
    cost: 200
    duration: 6000
    feather:
    info:
    name: 'use feather teleport'
    description: 'Allows you to use feather teleport for five minutes.'
    help: 'Type /tp tool to get a feather to use.'
    permissions:
    - 'tpp.mod.tool'
    categories:
    - 'utility'
    costs:
    buy:
    cost: 250000
    rent:
    cost: 200
    duration: 6000
     
  20. Offline

    rcjrrjcr

    I'll look into that.
     
  21. Offline

    darkwarriors

    forgive me.. but use count still doesnt work.. i try 20 jump with your default costs.yml in zip file and i can still use that command.. i try to reload server, restart server but i can still sue /jump command every time.
     
  22. Offline

    rcjrrjcr

    Is your jump command "/jump" or "/jumpto"? Try checking "/bab current". If it disappears but you are still able to use "/jump", it's a bug in Permissions. As I have said on the Permissions thread, I have sent a fix for that.
     
  23. Offline

    darkwarriors

    no.. everytime i do command /jump nothing changed in data.yml..

    Code:
    Data:
        darktest:
            world:
                Jump:
                    duration: 5
                    nodes:
                    - essentials.jump
                    type: USE
    
    everty time like this duration isnt decremented to 4..3..2..1. and removed as i said before i try restarting server reload config ecc but nothing change still duration to 5.

    the command is /jump because for /jumpto i have no right so permission was assigned correctly!

    and /bab current say every time 5 time left in world!
     
  24. Offline

    rcjrrjcr

    The abilities are saved only when you log out. Maybe I should compile a debug version for you.

    @darkwarriors Try using this debug build. Monitor the console for any messages.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  25. Offline

    darkwarriors

  26. Offline

    Mikor

    I can report similar behaviour in my server as well. Abilities are purchased, the permissions are now correctly assigned as of your last non-debug build's post (re: compatibility with Permissions 2.6), however when an ability is set to "rentuse", players are left with the ability to reuse the command indefinetly. My regular expressions should be fine as well, I've gone over the syntax multiple times, and there appears to be no errors.
     
  27. Offline

    rcjrrjcr

    ...
    I'm an idiot. I forgot to strip out the "RGX=" portion before checking.
     
  28. Offline

    darthsiddious

    so i have a question before i use this. my concern is that if i promote someone ingame, they will loose what they purchased. ill try it out, but if you could give me a heads up on that, it would be great, thanks.

    by the way, im getting an out of date error. running 670. thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  29. Offline

    rcjrrjcr

    Out of date error? Can you show me the console messages?
     
  30. Offline

    BioRage

    Ignored, mind looking at my request again?
     
  31. Offline

    rcjrrjcr

    Whoops. Sorry.
    If you mean you want Default to be able to access only "X", Citizen to be able to access only "Y", and Pickachu[sic] to be able to access only "Z", put each of them in their own categories, like ability "X" in category "CatX", ability "Y" in category "CatY" and so on. Then, grant Default the permission "buyabilities.abilities.CatX", Citizens the permissions "buyabilities.abilities.CatY", and Pickachu "buyabilities.abilities.CatZ". Hope this is what you meant.
     

Share This Page