[ECON/FUN] BuyAbilities v0.9.2 - Purchase Abilities [953]

Discussion in 'Inactive/Unsupported Plugins' started by andune, May 30, 2011.

  1. Offline


    BuyAbilities - Purchase Abilities:
    Version: v0.9.2

    Reviving the plugin originally written by @rcjrrjcr. This update includes iConomy5 and a number of other fixes. I've spoken with @rcjrrjcr and I will be maintaining this plugin going forward. Here is the link to the original BuyAbilities thread.

    So without further ado, here is the original description (with updates):


    BuyAbilities 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


    • 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 zip file
    Download jar only (for updates)


    Source Code

    • An economy plugin (iConomy 4 or 5, EssentialsEco, BOSEconomy)
    • A permissions plugin (Permissions 2.7, GroupManager)
    Usage Instructions:
    For players:
    • 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.
    For Admins:
    • 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.
      • "/bab reload" reload the abilities definition file
    • 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.
      • To allow live reloading of ability definitions, grant the permission "buyabilities.admin.reload"
      • 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.

    • Permission 3.x support
    • Permissions 2.7.x fixes for mixed-case names
    • PEX support (maybe?)
    • WorldGuard region support (permissions specific to a region)
    • Better messaging to users when rented abilities are expiring

    • fixed issue with abilities not persisting across plugin restarts & server reboots
    • fixed "ConcurrentModificationException" issues, reported by @Joy
    • fixed dangling "Categories: /" issue on "/bab info", reported by @Joy
    • added debug message to try to narrow down what's happening with mixed case names and Permissions
    • added live reload capability via "/bab reload", available via permission 'buyabilities.admin.reload'
    Show Spoiler

    • integrated Nijikokun's Register module (iConomy5 support)
    • bukkit ebean support for serializing user data
    • fixes to support Essentials 2.2.18+
    • other bug fixes
    • debug messages cleanup (converted to Logger log.fine())
    • Fixes ability removal bug. Iterators finally get a use.

    Suggestions and ideas are welcome!

    Credits: (from @rcjrrjcr)

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

    (And of course thanks to @rcjrrjcr for writing this great plugin to begin with!)

    Report bugs by enclosing the exception's stack trace, your costs.yml and data.yml in spoilers or preferably using pastebin.
    Taranis01 and Phaedrus like this.
  2. Offline


    I have installed it again (0.9.1).

    Permissions 2.7.3
    Essentials 2.2.18

    No errors in server.log, the same Problem as before. I can't use it.
  3. Offline


    Love it
  4. Offline


    I have a question for this plug-in. Does this mod allow us to deny access for a user to the buying of abilities through their chat box and support CommandSigns so that they have to use the signs themselves to purchase abilities? We're trying to set up a quest hub you see.
  5. Offline


    As mentioned before in the other thread, I need more info than this to solve the problem. Any errors in the logs? What other plugins are running? Can you post your configs for BuyAbilities and Permissions? (use pastebin) The more info you can provide, the more likely I am to be able to help you.

    No, this plugin is completely command-based at this time. I would someday like to tie it into WorldEdit/Guard to allow for permissions to be location-specific, so for example you could setup a sign-based market system for your players but restrict them (via location-based permissions) to only building shops in a specific area.

    It sounds like your request is more that you want people to have to click a sign to buy/rent a permission, as opposed to running a command?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 16, 2016
  6. Thanks for taking over this plugin.

    One bug report: /bab info Name
    Then categories is listed like: "Categories name/"

    That slash should not be there.


    And a bigger issue, have added nodes to buy. If I buy an node as admin, it works. but I just had a random player test it and get this error:


    I use PEX for Permissions, it is backwards compatible with PR 2.7, so should work right? I am not sure what BAB does exactly, to add/enable a permission...


    Also get this error on every login for myself now, as I was able to buy an ability, but it still bugs:

    13:13:41 [SEVERE] java.lang.UnsupportedOperationException: Unsupported (or deprecated) operation, sorry dude.
    13:13:41 [SEVERE]       at ru.tehkode.permissions.compat.PermissionHandler.setCacheItem(PermissionHandler.java:443)
    13:13:41 [SEVERE]       at com.rcjrrjcr.bukkitplugins.util.permissionsinterface.PermYetiHandler.removePerm(PermYetiHandler.java:84)
    13:13:41 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.AbilityManager.removePlayerAbility(AbilityManager.java:123)
    13:13:41 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.AbilityManager.loadPlayer(AbilityManager.java:162)
    13:13:41 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.BuyAbilities.processLogonLogoff(BuyAbilities.java:767)
    13:13:41 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.PlayerLoaderSaver.run(BuyAbilitiesPlayerListener.java:95)
    13:13:41 [SEVERE]       at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
    13:13:41 [SEVERE]       at java.lang.Thread.run(Thread.java:722)
  7. Offline


    That's correct.

    The commandsigns plug-in allows someone to run commands via a sign but most other mods require the user to already be part of the permissions group that allows them to use the command via their chatbox. uQuest included a /qadmin command which is used to give quests and allows admins to give quests while preventing users from giving themselves quests. The CommandSigns plug-in then uses a proxy/fake admin user called &commandsigns to allow us to restrist quest giving to the signs themselves. The sign then runs the command through the proxy user to give quests.

    We wanted something similar for purchasing abilities.
  8. Offline


    Easy enough to fix, thanks for letting me know.

    Thanks for the pastie. Top line of the stack trace is from the PEX "compatibility layer" which is basically saying that it doesn't support the setCacheItem() method that BuyAbilities uses for applying perms to Permissions 2.7. If the author of PEX supported this method in their compatibility layer, it should just work.

    Same deal here, note that the top line of the stack trace is the "ru.tehkode.permissions.compat" PEX compatibility layer. It doesn't support the full Permissions API (in this case, removePerm() is being called) so it's blowing up when BuyAbilities tries to call those methods.

    Sounds like a pretty cool system and I have to admit, I might use this myself if this feature were added. @KevinForte of the Vouchers plugin has sign-based capabilities for that plugin, perhaps he'd be interested in using his knowledge of sign-based capabilities to extend this plugin with those features as well?

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


    The frustrating thing is that Vouchers has the functionality of limiting player access to abilities, which is what we're looking for, but comes packaged with its own abilities with no way to link it into other modes. However this has exactly the kind of flexability we want but without the ability to limit player access. Gahh!!! :)

    I suppose the ultimate goal we're looking for us the ability to go to an NPC, open a vendor specific list of abilities someone can purchase and then let players choose what they want that way. No need for any commands other than selecting from the list presented to them by right clicking on the NPC.
  10. Offline


    I love you.
  11. Offline


    I would think it would be storing it in your permissions.yml file or database if you are using one.

    Edit - looks like it is using Persistence.
  12. Hello,
    maybe you should write something about sql connection in your first post. It's using setting from bukkit.yml, right? But it's not supporting MYSQL (why?), right? That should be writed somewhere. If any plugin is using bukkit's persistent SQL connection system, imo it should support both available methods (SQLite, MYSQL). If BAB is supporting MYSQL, something is wrong with our BABv0.9.1 and CB#803... It's writing to field "perms" this:
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.6.0_25" class="java.beans.XMLDecoder">
     <object class="java.util.HashSet">
      <void method="add">
    In addition, its able to handle only one perm (ability) for each player.

    It's saving to .db in BAB directory if you have SQLite set in you bukkit.yml (in root dir)... and to MYSQL if you have MYSQL set there :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 16, 2016
  13. Yea the table appeared now, sigh, my phpmyadmin was reading cached table listings until I relogged it seems :/
  14. Offline


    For some reason its recreating people in my permissions folder which is sending them back to the default group that cannot build. it doesnt seem to be adding to the pre existing entries in permissions but creating (along side the original) a new permissions row for people. i dunno if its case sensitivity or what, but i cant really use it if people are buying a demotion effectively XD

    Great plugin tho, just hope you find time to make a fix for this sometime ^^
  15. Ok major issue for me, with BAB + PEX.

    I bought 1 ability, and it's in the DB table. Then, I log on, buy a second ability, no errors. Then logout, and this happens:

    13:56:12 [SEVERE] java.util.ConcurrentModificationException
    13:56:12 [SEVERE]       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
    13:56:12 [SEVERE]       at java.util.HashMap$KeyIterator.next(HashMap.java:841)
    13:56:12 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.AbilityManager.saveAndUnloadPlayer(AbilityManager.java:181)
    13:56:12 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.BuyAbilities.processLogonLogoff(BuyAbilities.java:774)
    13:56:12 [SEVERE]       at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.PlayerLoaderSaver.run(BuyAbilitiesPlayerListener.java:95)
    13:56:12 [SEVERE]       at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
    13:56:12 [SEVERE]       at java.lang.Thread.run(Thread.java:722)
    PEX says it's a BAB issue. And there's no new entry in the BAB table, which should likely occur right when you buy the ability anyways?
  16. Offline


    Issue I have found. If I am listed on permissions as Heifinator (with a caps) the buyabilities will put the permission under heifinator (no caps).

    Permissions 2.7 is case sensitive so I cannot just make all my players lowercased =/


    I just read this other post, looks to be a case sensitive issue. This plugin puts all users as all lowercase and doesn't look for proper casing. Even if Heifinator exists it adds heifinator for example.​
    Hope for a fix soon, love this plugin!​
  17. Offline


    You need to be supporting 818 before your plugin will be approved.
    Also, your changelog needs to show the two most recent releases without a spoiler.
  18. Offline


    Sorry for the delay in answers, for some reason this thread was not updating in my Alerts list on bukkit.

    @Joy @Aiquen @Jeyge

    Yes, the original author had started some work to get BAB using Persistence, I finished that off to get it working again in 0.9.0. Sounds like it's all working as expected now, that's good to hear.


    You specifically mention it can only handle on Permission per user: it should be able to handle the whole list, although I haven't actually tested this myself. Would be interesting to hear if multiple permissions per ability is working for anyone else.


    Regarding PEX, there was an earlier conversation in this thread in which I identifed that PEX does not support the full Permission API (I think their compatibility layer is "read only"), so this will not work with PEX's compatibility layer unless they've fixed that issue. However, your stack trace does point to a separate BuyAbilities bug (independent of PEX) that needs to be fixed - thanks for the stack trace.


    Thanks for the caps issue report. I'm not aware of having seen anywhere in the plugin where it's intentionally ignoring case, but I will hunt around and see what I can find.

    My time is at a premium now that I'm back to work, but I will do my best to spend some time looking into these issues and try to get another update out soon to address a few of them.

    Ah, thanks for the info. I'll test it against RB #818 and update if appropriate as well as modify the ChangeLog as you suggest. Thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 16, 2016
  19. I am sorry, but did you read what I writed? :)) CB#803 (#813) + BAB0.9.1 are not working for us when its saving to mysql. We got error when BAB is trying to save on logout... it saves one record for every user only, and perm field at mysql looks like I writed (I do not believe, that!s right)-(I cant post it right now). Other our plugins are working with Persistence.
  20. Offline



    Can you tell me if the issue with renting abilities and the ability stays permanently has been fixed in the most recent version?
  21. Yea they added the setCache method to make it compatible, hence why this bug now appears :)
  22. Offline


    OK I'll look into this more. I'm using MySQL and it works fine, and another person reported the same in these forums. The perms field you wrote looks fine. I've confirmed multiple permissions per ability works and persists fine. I don't know about the "one record per user issue", can you explain that more? You might try dropping the "bab" table and letting it re-create, see if that helps.

    I do believe I've discovered a bug persisting across reboots, might have to do with transaction commits so I will be looking into that as well.

    Actually I think we may have the reverse problem now.. :) My use case is purely "renting", which works fine and I don't have any issues so far with abilities getting "stuck on". However my testing of long-term permanent abilities has been very minimal and I believe I've discovered a bug with those persisting across reboots that I need to look into.

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


    The title should really use only recommended build numbers, unless you require some srange versions.
    And version ranges should be only used when really needed
  24. Offline


    ok cool thx for letting me know, all i want this for is rent per use so if that works im happy :)
  25. Offline


    Fair enough, I was just copying convention I've seen on a lot of plugins that I actually use. I've tested this on RB 798, 818 and also 819, so that's why I put the range, so people know. I've updated as per your request, it now just says 818. Thanks.
  26. Offline


    Curious about if you plan to make this work with perm 3.1?
  27. Offline


    I expect I will since I want to update to Perm 3.1 myself at some point, but I don't have a specific date. I actually already have submittted a feature request for Perm 3.x that, if implemented, will make management of "temporary" (ie. rented) permissions much easier/safer with Permissions.
  28. Offline


    Let me know when it works , tried this back in the day with 766 and didnt work at all. Hopefull for 818
  29. Offline


    New version 0.9.2 released to address several of the issues mentioned below. Changelog:
    * fixed issue with abilities not persisting across plugin restarts & server reboots
    * fixed "ConcurrentModificationException" issues, reported by @Joy
    * fixed dangling "Categories: /" issue on "/bab info", reported by @Joy
    * added debug message to try to narrow down what's happening with mixed case names and Permissions


    OK I believe I have fixed the ConcurrentModificationException. Please give the new version a try and post a new stacktrace if you see the error again (you shouldn't). I've also fixed the dangling category "/" in the ability "info" listing.

    @BlazednIovinit @heifinator

    I had one of my players login to my test server, who has an uppercase in his name. I tried multiple tests to reproduce the issue, but was unable. However, I use GroupManager, so it's possible this is a bug in the code that is specific to Permissions (I haven't touched that code at all yet). A quick scan of the code that manages the setting of abilities shows it all uses player.getName(), so it should be using whatever the real players name is. Maybe somewhere lower in the Permissions wrapper or API it's getting converted to lower case, but I don't see it. To help, I've added the following debug line "BuyAbilities.addPlayerAbility(): world: world, player: morganm, node:essentials.home" when purchasing an ability. Paste me the lines from your logfile after you try it out with players that aren't working.


    I've tried to reproduce your issue a number of ways. I've verified multiple permissions works. Perhaps the error you were trying to report was the same one as Joy? Please try the new version and if it doesn't work, provide a stack trace of the error so I can look into it further.


    The mod is working again. If you would like to use it and let me know if you encounter any issues or errors, that would be great, otherwise I assume it to be working.
  30. Now I get this error, after buying an ability, then stopping server:

    10:28:52 [SEVERE] Error occurred while disabling BuyAbilities v0.9.2 (Is it up to date?): This method not implemented
    java.lang.UnsupportedOperationException: This method not implemented
            at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.storage.StorageEBeans.writeData(StorageEBeans.java:94)
            at com.rcjrrjcr.bukkitplugins.buyabilitiesplugin.BuyAbilities.onDisable(BuyAbilities.java:162)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:127)
            at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:771)
            at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:269)
            at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:262)
            at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:123)
            at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:260)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:341)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)

Share This Page