AutoPrice
AutoPrice Bukkit plugin
A shop plugin with GUI and dynamic prices.
Features
- Highly configurable.
- Good default configuration for lazy server owners (like myself).
- Designed to require minimum input from server owner.
- Commands and GUI (Graphical User Interface).
- Prices will automatically be adjusted based on supply and demand of each material.
- The shop can be accessed by any player at any location.
- The plugin keeps track of each material's stock, players can't buy more than has been sold.
- Item damage/condition is considered in price paid and stock increased. For example selling two items in 50% condition will earn you total 100% of normal price and add total one item to the stock.
Known limitations
- It takes a while for the plugin to learn the true value of each material.
- The plugin automatically saves the changed information to configuration file, so it's best to stop the server if you plan to work on the configuration file. You can however try to edit it quickly and use /ap reload.
- Materials in shop can only be rearranged by editing the configuration file. Renaming an item will however move it to the end.
- Each purchase is added to player's inventory as a new stack.
- Does not support the wildcards in permission nodes of PermissionsBukkit
Shop GUI usage
The shop GUI looks like a chest, but there are couple differences. The top window shows the items you can buy and bottom shows items you can sell. When hovering over any item, information about that material is displayed (price for example).
The amount you sell/buy depends on the type of click
- Left click = 1 unit
- Right click = 4 units
- Shift + left click = 16 unit
- Shift + right click = 64 units
To change page on top/buying part click the empty slot
- Left click = next page
- Right click = previous page
Requirements
AutoPrice is just a shop plugin. For AP to work you will also need to install an economy plugin like Essentials economy. AP does not directly support any economy plugins so you need to install Vault that works as an adapter between AP and the economy plugin of your choice.
Infinite stock
Here's an example how to configure an item to have infinite stock. Here the purchase price is 0,55 and stock is infinite. The plugin normally adjusts prices based on purchases and sales, manually adjusting stocks can cause issues with dynamic prices.
APPLE: baseSalesPriceForPlayer: 0.5 mainMaterial: APPLE subMaterial: 0 stockPerPurchasePrice: 0,55: !!float 'Infinity'
Questions & answers
- How to get stock?
- Let players sell stuff (prices will slowly normalize) or set stock manually in the configuration file (but don't expect the plugin to learn the value of the item).
- How to increase the prices?
- Let players buy all the stock and wait for the prices to increase. If all prices raise too slow, decrease updateIntervalTicks in the configuration file. Low supply & high demand = high price.
- Why does the sales price of an item drop to 0.01 as soon as I sell the first one?
- Cause that item now has sales but no purchases. High supply & low demand = low price.
@FTOtter
updateSalesPrices fails. Sales prices won't increase even if the price is too low and no-one is selling. AutoPrice version 4.043 requires CraftBukkit 1.7.10-R0.1.
@tubelius
Here's a paste of my latest log: http://pastebin.com/8JrKy2GF
Weird part is that the plugin seems to function just fine in-game, at least as much as I have tested it so far (which is not all that much to be fair).
@FTOtter
I need some details. Please copy-paste all of the error to http://pastebin.com/ , submit and copy-paste the address on your reply. Or you could try to update following to latest version: CraftBukkit, AutoPrice, Vault.
I am always getting that task #32 generates an exception on my logs. Any idea what ythat means or why it's happening?
@madtomic
I suggest you update your CraftBukkit as soon as possible. Anyway AutoPrice v3.082 is your best bet with CraftBukkit 1.7.2-R0.3. Might be a bit glitchy, but probably works without major issues.
@xandervc
To have stock, you have to sell items to the plugin first. The plugin will only sell to players what players have sold to it.
If you want an item to have stock without players having to sell it stock you have to configure it that way.
There is an example of how to do this on the Overview page:
How did you make it so there is something in the stock?
Can I use this with CB1.7.2-r0.3?
@tubelius
Alright.
Thanks for all the help. Well let you know how things go after a day or two of testing.
@MCCharlieCraft
stockAmountMinObjective under material will be used. If it's missing the global defaultStockAmountMinObjective will be used. If total amount of stock is below the value, the sales price will increase no matter what's the purchase price. Both settings will be removed and "1" hardcoded into the code.
@MCCharlieCraft
I'd set any/all of those objective values to 1. You could let the players keep selling/buying until the prices get fixed, or fix the sales prices to configuration manually.
@tubelius
So with this information do you recommend I reset the shops, or will setting StockAmountMinObjective to 1 bring things back in check after a small amount of use?
I am confused about this setting:
Is this a global value, or for individual items? Trying to figure out how this affects the rate at witch items fluctuate in price.
EDIT: You explained it in your last comment.
@MCCharlieCraft
Thanks for your patience and information. I finally found the bug. It only happens when stockAmountMinObjective or defaultStockAmountMinObjective is higher than 1. As long as number of stock is below the objective the sales price keeps increasing. It can increase above purchase price as the plugin hungers for more stock. But of-course players will just buy&sell and the number of stock doesn't actually increase. This will be more obvious with lower ticksBetweenPriceUpdates values. For now the objective should be set to 1 for the plugin to work correctly.
I'll remove those options completely from next version. They don't work correctly and they are not very useful anyway. In next version the plugin will work same as with default configuration (stock objective = 1): the sales price only increases when there's no stock or it's below purchase price and there haven't been transactions lately.
@MCCharlieCraft
It wouldn't make sense if players were buying the most expensive stock. Then purchase price would decrease more they buy. When prices are based on supply and demand, it means that prices increase when there's more demand. The question is why the sales price is higher than purchase price.
The other problem I am noticing is that the plugin will always sell the cheapest stock first, regardless of the order the items were received. This also helps the plugin continue to sell cheaper than the current value.
The 0.03 was the first sold to the plugin. All the others came later. The 0.02 were sold to the plugin last night, and it is what it is selling this morning. Every amount that is not 0.02, or 0.03 is what the plugin sold and repurchased above the value of the current stock.
@tubelius
The edited log was 1.8MB, so I mailed it to your gmail. Thanks for the tutorial on how to manage the logs. I had no idea that was possible.
@MCCharlieCraft
Hey. I wrote a guide for posting the logs more easily: http://dev.bukkit.org/bukkit-plugins/autoprice/pages/posting-logs/ . If you want you can also e-mail all the logs to me at [email protected] . I plan to implement the feature to fix the prices when sales price is higher than purchase price, but that's low priority now. I have tested and used all released versions. I never had the plugin itself set purchase price below sales price or set sales price above purchase price (from player's point of view). At this time the issue seems to affect only your server. I hope to figure out what caused the issue before implementing new features to patch the effects.
I honestly don't want to dig thru days of logs to find it. It took enough time editing the previous logs to remove all the non autoprice info. Unless you just want me to put up raw logs.
Just change the math to something like:
If current stock purchase price is less than sales price for player, than set purchase price to sales price for player + purchase price multiplier. idk. All its doing now is selling current stock + price multiplier regardless of current value.
To see what it is doing, all you have to do is run the plugin on default settings. Its not something that is happening because I have edited the config.
@MCCharlieCraft
The configuration and the log clearly shows that the sales prices are higher than purchase prices for some items at this point. At this point the prices are going the right way, fixing the issue. I'd like to see an earlier log from the time the prices went wrong. Could you find the log from the time the sales prices were lower than purchase prices (as they should) until they were higher (started to cause losses).
At first I was using the default config.
Now I am using a custom config I made yesterday, but its still having the same problem.
Current config: http://pastebin.com/kEvzw9ti
Log of players buying and selling for profit http://pastebin.com/m7PHefBW: