[ECON] GoldStandard v1.0.1 - Item based dynamic currency system for iConomy [953]

Discussion in 'Inactive/Unsupported Plugins' started by Ballistic Buddha, Apr 26, 2011.

  1. GoldStandard: A Driving force for free market economies
    Version: v1.0.1

    Note: A third party library "GNU Trove" is required in order for the plugin to run, it is included in the .zip version and can be downloaded independently here.

    A Note to those upgrading to v1.0. You will have to either update or drop your SQL tables:
    1. MySQL users, use this script.
      1. Edit the file with your favorite text editor and replace both instances of <schema> with your schema's name.
      2. If you are running your mysql server on linux execute the following command from a terminal as root: "mysql -h [hostname-or-IP-address] -u [username] -p [database-name] < update.sql" and replace everything within the [] to the variables relavant to your instance, it will then ask you for your password from the tty and you would be done.
      3. If you are not running linux or are unfamiliar with the shell, just copy everything in the update.sql file after replacing the <schema> variable then just run those 2 commands any way you choose. I would also like to recommend the MySQL Workbench, which is a pretty solid GUI utility to administrate your database, which also includes some utilities from running SQL scripts or if you prefer you may just run commands directly from the GUI to update your database.
    2. H2SQL users, hang tight as I brew up a solution for those of you who don't want to reset your price values, if you are okay with resetting your prices, just delete the .db files in your plugins/GoldStandard/ folder
    In brief, this is a dynamic currency system for iConomy that lets you set parameters that will let the value of currency fluctuate (if specified). As of Version 1.0 it can now be used as a full-fledged dynamic economy, complete with any mixture of relative and independent price scaling! There are also options to use static pricing mixed in with dynamic pricing.​

    More About GoldStandard (open)

    So, I mainly started making this plugin a little while ago to get my feet wet with the bukkit API. It started out as just a way to sell a single item only, but I have since updated it to be more modular. The primary purpose of this plugin is to accompany an economic system similar to iConomyChestShop that is more trade and barter based, rather than based on selling and buying items directly to and from the server. However I noticed that the problem I had once I first set up iCS was that although people could buy items sold by other players, people had no means of actually generating money, as I didn’t quite fancy the idea of letting everyone sell items to chests. Hence, GoldStandard was born!

    GoldStandard is a selling system based on the idea of scaling prices based on supply and demand. Currently, the plugin only allows you to sell one specific type of item such as Gold Ingots, useful due to their rarity and lack of practical use, thus basing the driving force of the entire server’s economy on who has the most gold, and indirectly relating the value of all items in-game to the price of gold (or similar item).

    When used in conjunction with an adequate trading and buying system to act as a type of auction house, admins may indirectly control the price of all items on the server by directly adjusting the price of one item. There will be no longer be a need for admins to set specific values for any items or minerals except for the chosen item; rendering the need for setting prices for new items redundant. The prices of all items will eventually reach equilibrium as they adjust based upon how the players decide to buy and sell items to other players. With this plugin running alongside a “finite” buying system, admins might find it easier to stabilize an economy by adjusting the price of gold to the right range that suits their needs.

    Features
    Price Scaling
    Note: I'm currently working on getting better examples and explanations of how this works, but for now you can download the .zip version and examine the sample config included within it.
    The price of items works by either using static or dynamic pricing, using the following formulas:
    Code:
    For Dynamic Pricing (never goes outside the bounds specified):
    <current price> = <base price> - (<ratio>*<# of transactions>)
    For Static Pricing:
    <current price> = <base price>
    The number of transactions is found by querying the database for the number of items sold in the past X days (where X is a number specified in the config file)
    Relative items scale in relation to the base item. Making them effectively a sub or super unit of the base item. Transactions of relative items are effectively weighted based on their "relation" variable. Meaning that selling one relative item with a relation of .1 is effectively one 10th of a sale of the base item. Alternatively, if the ratio is 10, it will effectively count as a sale of 10 base items.

    Selling In-game
    Selling and Buying with GoldStandard can either be done commandless or via commands. For the non-command option, you must first create a "sell list", which is a list of all items that you want to sell. To modify this list use the commands /gsadd and /gsremove, you can add and remove multiple items with one command by comma separating their names/ids. After you have created your sell list, put a stack of all of the items you wish to sell into a furnace, chest, or dispenser in any slot, then left-click the container with the sell tool (Gold Sword by default), and viola! Minecash! Any items not in your sell list will remain untouched. If you’re really impatient you can just keep hitting the furnace while you are smelting gold ore, given that your action cooldowns aren't too long. You can also use commands in addition if specified in the config.
    Buyback
    You may also buyback items if allowed, to buy w/o commands you must first specify a buy item and quantity with /gsset. For instance, if I wanted to buy redstone in stacks of 8 the command would be /gsset redstone 1. After you specify a buy item, simply hit an empty valid container with the sell tool to buy the item stack. Alternatively, if the command option is enabled, you may use /gsbuy to buy multiple items at once. Buying an item will increase the value of the item relative to the ratio.
    Commands (open)

    Note: ItemIDs are synonymous with their nickname
    • /gsworth || /gsprice <itemIDs>- displays the current sale price for the selected items, comma seperate item names for multiple checks
    • /gssell || /gsell <items> <quantities>[Block Option] - sell x of item taken directly from your inventory
      • Comma sperate items and quantities, qtys match items in their respective order
      • The block options are ~ and *
      • Append the special character to the end of the amount like so:
      • /gssell 20~ - this sells 20 of the item in your inventory and counts blocks as 9x where applicable
      • /gssell 20* - same as ~ but will return your "change" in blocks if applicable
      • These characters do nothing if not applicable or not allowed
    • /gsbuy || /gbuy <items> <quantities> - buy items and insert them directly into your inventory
      • Comma sperate items and quantities, qtys match items in their respective order
    • /gsreset || /gsclear - Admin command that resets all prices back to their initial prices.
    • /gsadd || /gsa <items>[Block Option]
    • Comma separate items to be added
      • Append ~ to the end of the name/id to include blocks
    • /gsremove || /gsr <items> - remove items from your sell list
    • /gsset || /gss <item> <quantity> - set your item and stack size to buy
    • /gslist || gsl <but|sell> - display the items you are currently buying or selling
    • /gshistory || /ghistory <ItemID|Nickname|*> [sales(+)|purchases(-)|net(blank)]- Command that queries the database for the number of transactions
      • * is a wildcard that gets the history of all items
      • the type argument is optional, if blank it will get the net transactions
      • + and - are shorthand for sales and purchases respectively


    Requirements
    • GNU Trove (Packaged with the .zip file)
    • iConomy (iC Version 5.0+ as of GS version 0.7)
    • Permissions (If enabled)
    • MySQL (optional, requires mysql-connector-java-bin.jar in lib folder)
      • if you have already setup iConomy, you should already have this
    • H2SQL libraries (optional, requires h2.jar in lib folder)
      • if you have already setup iConomy, you should already have this
    • LWC (If using container protection)
    Configuration

    There are now 2 .yml config files. config.yml is for general plugin settings such as the duration, reload interval, and data source. items.yml is where all item-related configurations are set; INCLUDING price scaling options such as base, min, max, and ratio. Some settings are in both such as Buyback. In this case the setting in config.yml is the default and can be overridden for a specific item in items.yml.
    Example using Dynamic Pricing

    config.yml
    Code:
    #ItemID of the selling tool for commandless selling
    SellTool: 283
    #how long to keep records (in days)
    Duration: 7
    #How often (in minutes) to clean the database of old records (if needed)
    Reload Interval: 60
    #This option applies only to Gold Ingot, Iron Ingot, Diamond Gem, or Lapis Lazuli Dye
    #it enables selling one block of the equivilent material as 9x of the item
    #if an item cannot be represented as a block, this is ignored
    #this can be overridden for a specific item in items.yml
    Allow Block: true
    #enable buying (enforces the ratio in an inverse fashion)
    #this can also be overridden for a specific item in items.yml
    Buyback: false
    #Options: Chest, Furnace, Dispenser, Command
    SellMethods:
        - Furnace
        - Chest
        - Command
    #Protection system to use (LWC or none)
    Protection: LWC
    #MySQL, H2SQL or none
    Data: MySQL
    MySQL:
        database: minecraft
        hostname: localhost
        port: 3306
        username: mc
        password: pass
    
    items.yml
    Code:
    #Items are listed on level 1 by a specified nickname
    #the nickname can be anything as long as they are unique, but be aware that it will be shown in game
    #Currently, only one item is allowed and it must be a "base" item
    Items:
        Gold:
            #Decimal itemID of this item
            Id: 266
            #This is an optional override of the setting in config.yml for only this particular item
            #To use the default, delete this line
            Allow Block: true
            #This is an optional override of the setting in config.yml for only this particular item
            #To use the default, delete this line
            Buyback: true
            #There can only be one base item, it is a special item that is considered the basic unit of a multi-tiered economy
            #The price of the base item is always calculated from the base price
            #can only be base in version 0.8
            Type: base
            #base sale price of the base item
            Price: 100
            #minimum sale price of the base item
            Minimum: 50
            #maximum sale price of the base item
            Maximum: 200
            #decrease in price per item sold, increase per item bought
            #Sorry, but this must be in decimal format now :(
            Ratio: .1
    
    In this example, the item to sell is a Gold Ingot and the selling tool is a Gold Sword. The price of gold starts at 100 and decreases by 0.1 for each gold ingot sold until the price reaches 50, at that point it will stay at 50 until either transactions older than 7 days get cleaned out (assuming that a lot of the transactions didn’t just now take place) or the price gets reset by an admin. In other words, If the price is currently at the ceiling, and I sell enough gold to bring it down to the floor price right now, the price will stay at the minimum for 7 days unless reset by an admin. However, if I were to sell about half of my gold now and bring the price down to 75, and than 4 days later sell the rest of my gold to bring it down to 50 (assuming the rest of the players on the server haven’t sold any gold in the past 4 days) after 3 more days from this point (7 days from the first sale), the price will adjust as if I had only sold the second half of my gold.

    Example config.yml file using Static Pricing
    config.yml (open)

    SellTool: 283
    Reload Interval: 60
    Allow Block: true
    Buyback: false
    SellMethods:
    - Command
    Protection: none
    Data: none


    That’s really all you need. You can keep the above items.yml exactly as it is in the dynamic example above, and all of the scaling options will be ignored. Just be sure to set data to “none”, because it will cut down on the resources this plugin uses by A LOT. The same goes for block protection, if you don't want to enforce block protection (which is recommended if you are only using the command option), set the option to "none".

    Permission Nodes
    Code:
    goldstandard.sell - enables selling and use of the commands /gsa, /gsr, and /gsl sell
    goldstandard.buy - enables buyback and use of the commands /gss, and /gsl buy
    goldstandard.worth - enables the command to check the price
    goldstandard.reset - enables force resetting back to the base price (recommended as an admin-only command)
    goldstandard.history - allows the player to run history queries
    
    Planned Features for the Future
    • Ability to use SQL to store item information
    • Formula declarations for relative items (e.g. '<Gold>/10') to declare relative items more intuitively, or at least a yaml node to set what an item is relative to, instead of having the relation necessarily relating to the base item.
    • Add option to /gshistory to select based on the user who did the transaction, and head/tail options
    • "odd-item" support (like dyes and cloths)
    Wishlist (things I’d like to do if I have the time)
    • Exponential price scaling (dynamic relations)
    • Create an option to retain logged transactions even after they have expired
    • A web-api to query transactions (even past their expiration) to show trending of item prices.
    Known Issues:
    • Double chests act strange, selling from a double chest will only sell half of the items, thus requiring users to hit both sides of a double chest to sell all items within it.
    • Fractions in the .yml file no longer work, you have to put them in decimal format
    • There is no support for "odd items" such as dyes and cloth, and there is currently no way of using such items as currency.
    Changelog

    • Version 1.0.1
      • Fixed table creation with MySQL, and improved default player values for both H2 and MySQL database tables.
    • Version 1.0
      • Added support for multiple items. (see the example configs for how to implement)
      • Fixed an exploit with buyback by making the buy price have a pre-increment price adjustment
      • Added option to not use permissions.
      • Further implementation of trove to help reduce the memory footprint
      • Added action cooldown for buying and selling (independently)
      • Options for "buyback" and "allow block" can now be overridden on a per-item basis
      • A bunch of other tweaks and bugfixes, too many to list.
    Older versions (open)

    • Version 0.8
      • Switched to a new configuration format, containing 2 files: config.yml and items.yml, see the configuration above for more info.
      • Added command /gshistory for admins to run a basic query of past transactions from in game
      • Added an option to sell Iron,Gold, and Diamond blocks as 9x ingots/gems.
      • Redesigned the internals for buy and sell procedures in preparation for v1.0
      • A few other minor bugfixes
    • Version 0.7.2
      • Resolved some database connection issues that caused issues when reloading the plugin rapidly (like by doing a /reload from in-game)
    • Version 0.7.1
      • Fixed a bug causing errors when selling the last of your item via command
    • Version 0.7
      • Added H2SQL support :D
      • Updated to iConomy5
      • Added "Reload Interval" parameter in the config
      • Added "item" database column to prepare for multi-tiered currencies
        • If you were using a previous version you will either have to alter the table to include the "item" column or just delete the table (which will obviously reset your price)
        • If you switched to using H2SQL, no worries, your DB is already properly formatted
    • Version 0.6
      • Added Option to enforce LWC block protection while selling from containers
    • Version 0.5
      • Added Buyback option (has an increase in price per transaction)
      • You can now use any of: Chest, Furnace, Dispenser to buy/sell gold
      • Added option to buy/sell via command
    • Version 0.4
      • Initial release to the public
     
    Llamageddon, smickles and kahlilnc like this.
  2. Offline

    SwearWord

    Right I understand but I thought of something else.

    If gold is worth 10 coins and decreases by 1 coin every time I sell an ingot, shouldn't selling 2 ingots give me 19 coins and not 20?

    That's how I've decided to do it in my plugin.
     
  3. @SwearWord

    That's how transactions have always worked in my plugin too, and changing buying to pre increment fixed the exploit for me. So was your original problem only when buying & selling more than one item at a time then? If you're wondering how to perform bulk transactions, try looking at my source, you might figure it out from there, more specifically the BuyProcedure and SellProcedure classes. Keep in mind that the HEAD of my git repo atm is in a non-working state, so you might want to pull an older version (like the 0.8 release code).
     
  4. Offline

    SwearWord

    I figured it out already. Did you use a variation of n(n+1)/2 to calculate the total cost? That's what I did.

    The problem I was having was instead of specifying how many gold ingots to buyback mine needs to specify an amount of coin and buy as many ingots as you can with it. I just solved the previous equation for n and it works.
     
  5. Well, mine's a little simpler approach. Pretty much every time a user sells multiple items, it will increment a counter within memory and re-calculate for every single item in the batch, then log the transaction as if it were one operation and charge them the sum of all of the calculations. However, your method works just as well (with less calculation time probably too), for if you are just using straight scaling items, that is the formula the result will come to anyway. However, My plugin has a little more at play, because it uses "relative" items, which complicates things a little more. But that calculation should work you you.
     
  6. Offline

    SwearWord

    Yep I just finished it and it's working well. Thanks for your help.
     
  7. Offline

    freefish

    Is there any easy way for me to make this change to the source of the plugin while I wait for an update? I've caught users of my server abusing this bug now and making large amounts of money.

    Much wailing and gnashing of teeth ensued.
     
  8. I'm about 90% done with v1.0. The only thing that hasn't been updated yet is command-less buying of multiple items. So if you only use command buying anyway, I might be able to send out a "testing" version tonight. Every other feature has been implemented though (multiple item support, multi-tiered currency, relative and independent items, the fix for buying, buy and sell action cooldowns, null-permissions, improved database structure, more thorough implementation of trove). However, the update is HUGE, and hasn't really been tested at all! So, if you are okay with that I can post up a testing version tonight that will at least fix the buying exploit, and again, sorry for taking so long on this.

    Edit: I'm still stuck at work atm, but I would at least like to do some unit tests once I get home first to make sure that basic functionality is still working.
     
  9. Offline

    kevile

    Having the same issue with players exploiting the buy/sell -- will that update be coming out this weekend? *hopes*
     
  10. Hoping this will be updated for 860 soon
     
  11. @freefish @kevile @Jonathan Bouligny

    Okay, I have composed a testing version of 1.0 for you all to try out. and it DOES contain the fix for the buyback exploit, and I have been developing and testing it against CB 860.

    I would much appreciate it if some of you would try out this testing version that is feature complete, however may contain some issues. The update includes a huge increase in configuration possibilities, therefore making testing every possible configuration a nightmare. Even if I did automate some of the testing I'd still feel like I might have missed something. The only known issue I have found so far is that block inclusion (e.g. selling gold blocks as 9x gold ingots) is effectively broken, and I have been trying to nail down the issue and beat it into submission.

    Some other features this includes:
    • Multiple Items (finally)
    • Buy/Sell Items come in four different types:
      • Base (there can only be exactly one)
        • The base unit of your currency, all relative items will be based off the price of this item.
      • Relative
        • Items that have their price is derived directly from the current price of the base item.
        • The weight of transactions of relative items are also scaled relative to their "relation"
      • Independent
        • Configured just like base items, however, they have no impact on the price of any other items
      • Fixed
        • These items never change in price, and will always be sold and bought at the same price
    • Buying and Selling now have optional cool-downs (also an option for ops to obey the cool-down)
    • An option in config.yml to set Permissions to false if you either do not use a permissions plugin or prefer to give all users uniform access.
      • However, even with permissions set to false, only ops can perform a /gsclear
    Give it a try if you will please, download link below.
    http://bit.ly/lH3mhZ
     
  12. Offline

    SaltyStick

    Is there a way that you could implement say other blocks for other values.
    For Example.

    Diamond = £50
    Gold = £20
    Iron = £10
    Lapsis = £5

    Etc.

    If there is i think that would be ace!
     
  13. Currently lapis is kind of screwed, mainly due to the fact that is plugin doesn't support odd items yet. So, basically any of the dyes or cloths cannot be used in this plugin unfortunately.

    However, if you wanted to have other prices for the blockable items (iron, gold, diamond), you could always just disable the "allow block" option for diamond gem, iron ingot, and gold ingot and create a new entry for those three items and set their parameters accordingly.
     
  14. Offline

    SaltyStick

    im not all with all this stuff you wouldnt be so kind in listing what i would need to enter could you?
    I'm a newbie so getting there slowly :p

    ta
    Pete.
     
  15. Offline

    freefish

    Hitting an NPE on /gsell. (exact command: /gsell gold 10)

    Exception (open)
    org.bukkit.command.CommandException: Unhandled exception executing command 'gsell' in plugin GoldStandard v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:128)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:287)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:712)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:678)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:671)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:399)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:309)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
    at com.bukkit.BallisticBuddha.GoldStandard.GSCalc.timeSinceSold(GSCalc.java:200)
    at com.bukkit.BallisticBuddha.GoldStandard.GoldStandard.onCommand(GoldStandard.java:244)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    ... 12 more


    Have only gold configured with pretty much the standard config for that, using MySQL, and buyback enabled.

    Edit: Another error I'm seeing in logs:
    21:38:01 [INFO] freefish lost connection: disconnect.quitting
    21:38:01 [SEVERE] [GoldStandard] Error when storing user freefish
    com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '1969-12-31 19:00:00' for column 'lastBought' at row 1

    Further ninja edit: Installing a fixed version of iconomy and Permissions made the first bug apparently go away. The second still occurs.
     
  16. Offline

    sleite

    Wish List:

    - Flatfile Support
    - Economy of "items" instead of "dollars" (eg. Make iConomy optional)
    (Eg. 1 diamond = 10 gold. 1 gold = 10 iron. Etc).
    - Love the idea of a fluctuating economy based on supply / demand. If everybody wants to buy diamonds for example, maybe the cost goes up to 20 gold per diamond, or even 50 gold per diamond if demand is insane.
    - Support to interact with the Citizen's MOD.
    (Eg. Players can do trading with NPCs, and not typing commands or interacting with a Furnaces or a weilding Gold Swords - all of which seem very odd to me.)

    I realize probably none of these things will ever be added, but I just thought I'd comment anyways .. just in case!

    For now .. I'll continue using my own system for currency.

    Cheers.
     
  17. Im geting exactly the same thing. With 860 on v1
     
  18. do you have the trove-3.jar in your lib/ folder?
     
  19. No, should I?

    EDIT: Ah yes I see now, I had been installing from your 1.0 test file, so I missed the lib files. Working now.
     
  20. yes, unfortunately it is required to be there for the plugin to do anything :(, but the .jar is included in the .zip version

    This has been an issue that has been bugging the hell out of me as I have yet to figure out a way to somehow include it to be automatically extracted or downloaded.
     
  21. Offline

    freefish

    Another bug I've found just a moment ago. Not sure what triggered it but I saw it go by in the log:

    Bug (open)
    19:23:08 [WARNING] Task of 'GoldStandard' generated an exception
    java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
    at java.util.HashMap$KeyIterator.next(HashMap.java:828)
    at com.bukkit.BallisticBuddha.GoldStandard.GoldStandard$1.run(GoldStandard.java:476)
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:438)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)

    Looks like you're editing the HashMap in the loop while it's being iterated over, or something?
     
  22. Ha, indeed. Actually forgot I was doing that as the removal was buried a few classes deep. I've got an idea for a fix and I'll try it here soon, I actually think the removal at that point in the reload thread is actually unnecessary.

    ...I think this might be why I haven't earned my "Plugin Developer" forum tag yet >.<

    EDIT: fixed.
     
  23. Offline

    Sparky222B

    [​IMG]


    [​IMG]

    Bukkit 928
     
  24. @Sparky222B

    Yeah, sorry about that. I didn't realize until yesterday that h2sql was completely broken.

    However, I fixed it today. I've also spent the last few days familiarizing myself with github more and am committing more often as that is now my primary source for remote code hosting, and I will completely be moving away from dropbox soon for this project.

    I have a couple other issues I want to attend to before packing up another .jar. 1 being the issue that @freefish posted a while ago about the errors on player disconnections, however I think that error is only when players have not yet bought & sold, so it takes a lower priority than the second which is that block recognition still isn't functioning properly. Once these 2 are fixed I'll update the thread to make it "version 1.0 RC1".

    Also, thanks all for helping me with testing.
     
  25. Offline

    freefish

    Github's great, isn't it? Thanks for your work on this!
     
  26. Offline

    Sparky222B

    Sounds good. Are you planning to build a jar and update the thread, or should I pull it down and build it myself?
     
  27. Actually, I have since found and fixed some issues already in the version that I lined above. If I were you I'd wait a little bit until I have a little better confidence in the stability of the current version, i.e. until I do a few more unit tests. Also, I wont update the thread immediately because I am planning on completely re-designing the first post which might take a while. So I'll first put out a release candidate just as a link for some people to try out, and meanwhile I'll be working on the documentation. Once I finish the doc work, if there are no new errors I'll go ahead and call it "release".

    @freefish
    Also, I think I have have semi-fixed the issue of the error that is thrown on a player disconnect. I have seen it a couple times which kind of sucks because whenever that happens that player's sell/buy lists are not retained the next time they log in. However, I can tell you that the error only appears when a new player who has not both bought & sold yet logs out. After they buy & sell for the first time, they will never throw the error again and their information will now be correctly stored into the database from now on.

    P.S. I believe I fixed the selling as block issues, that now only leaves the one issue of the new player disconnects, if it persists I might just add it into the new list of known issues. All I need to do now is just do some more thorough testing and I'll have a release candidate ready! However, at first I'll just post it as a thread response because I severely need to update the "documentation" in the original post as a lot has changed now, I'll work on having a stronger focus on examples (and possibly make a video tutorial?) as I believe that is the best way to explain how this plugin works.

    Hold tight until I finish up 1.0. I'm aiming to finish it before notch releases 1.7, which he predicted would be Thursday, because there is a possibility that I might have to update the plugin for the upcoming RB for 1.7, and I want the new features to be finished and to have most of the bugs ironed out before then.

    When that happens I'll put up some better examples in the OP in this thread that should make it a little easier for everyone to understand how it works and how to configure it.

    Hey @sleite, interesting suggestions, I wouldn't say that none of these would be implemented, but I figure I'd give you some input on what I might find possible/within my limits.
    Recently I have been pushing to make SQL more ubiquitous as I find it much better as a means of holding larger sets of data (like the gslog, which contains every transaction each player makes). In fact the next update (1.1) has a lot more SQL integration planned for it. I included H2SQL as a means of people who wanted a more lightweight solution that doesn't include any setup of any kind. H2 is great as an integrated database, and if you don't really have a need for MySQL (e.g. You are the sole admin of your server that doesn't have a high player count) a memory database like H2 or SQLite is probably the best solution. However, I really don't like the idea of storing something like a log into a flat file as retrieving that data can be massively slow. Additionally, this plugin takes advantage of using things like where clauses, which make it not only faster than pulling from a flatfile, but also easier to integrate into a front end application.

    Anyway, I digress. I'm not saying that I don't ever plan on implementing flatfile support, but If I do put work into that it will defiantly come after I have included more SQL integration options.
    Now I'm not completely sure what you are suggesting, but if you are pondering what I'm pondering, this is actually quite an awesome idea! Something along these lines has actually been on my wishlist as well. If I understand you correctly, it looks like you are suggesting that for relative items, have the relation variable also scale, along with the net transactions. Thus making base and relative items scale exponentially rather than linearly like they currently do, but still have a linear relation to other relative items and the base item. This being a result of the fact that the "relation" is no longer static, but now scales upon the item's own popularity. Thus making it possible to have a single item that is wildly popular that has a price that is out of control, and would possibly result in hyperinflation & economic bubbles, however the plugin will probably not go there yet due to the fact that there is always a buyer (i.e. the server) so it makes this phenomenon less possible. This sort of real-world-economy simulation is at the heart of why I am making this plugin, I personally think that being able to replicate real world human behavior in a virtual market is just fascinating.

    I do agree that the current transaction mechanics are pretty wacky, and I really don't think they should stay the way they are forever. I don't, however, what to remove the current sell/buy methods, but I definitely think that more methods wouldn't hurt. That being said, I have been trying to figure out better methods for transaction mechanics, but integrating into an external plugin like citizen's isn't a bad idea. I'll look into what the plugin offers in terms of external plugin availability and see what I can do.

    While having an economy that has no abstract currency is actually a pretty cool idea, unfortunately that is not the focus of this plugin, as this plugin is meant to work as a physical item (gold ingots, iron ingots, etc.) trade system that interacts directly with the abstraction layer (iConomy dollars), and has a dynamic exchange rate between those two layers.

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

    Sparky222B

    @
    JUnit is your best friend. The plugin is really quite good, I look forward to future improvements.
     
  29. Offline

    mike0fmikes

    I'm pretty excited about the prospect of having a full fledged version of this mod. I've been running it on my server for about two weeks with zero issues.
    We have player owned shops on our server, but when you're down in the mines you don't want to come all the way back up and shop around for the best sell price, just to go back down into the mines again.
    Once you have all items added to the list this mod will in fact create a global economy. That way if you do go shopping you can check the price of an item in the world economy before you commit to buying from an individual. I don't know if you've ever player "Age of Empires: 2" but in that game there was a global market that fluctuated based on how much of a resource was being bought or sold. I hope that when this Mod is fully featured, it works somewhere along those lines.

    Can I make a suggestion:

    If you intrinsically link all the items to the base item, then you can use simple math functions to determine their base price (in effect, making it so users don't have to hard-line code values into the .yml file)

    Something like: wool = gold_ingot * .75

    That way all items base price inherits from the main price. So, for instance, if there comes a time when base prices need to go higher (like if the server fills up with wealthy players at some point) then you would only need to change the base item's base price, and everything else down the file would change in kind.

    Great work! And I'll be counting the days until the rest of the items are added!!!
     
  30. Offline

    SaltyStick

    I'm holding onto my seat like it was hanging off a cliff!

    Cant wait. Thanks mate.
     
  31. @SaltyStick @mike0fmikes @Sparky222B @freefish

    Alright guys, 1.0 is out! I brushed up on the majority of the issues you all helped me found and some other i found later as well. Have at it and go nuts!

    P.S. MySQL users will have to run the .sql script linked at the top of the page. Unfortunately I don't have an update script for H2 yet, but if you know H2 syntax fairly well it shouldn't be too hard to translate the update script into H2 grammar, alternatively, if you don't mind resetting your prices, just delete your database files.
     

Share This Page