Supply N Demand
Supply N Demand rewards players for adding items to chests, and charges them for removal. This plugin adds the flavor of capitalism to your market to keep things fresh and delicious. Those who add items to designated "Supply" chests are rewarded in the form of money. To remove items from such a chest requires money. Thus, those who add more can take more; those who work harder and share, get rewarded.
Sharing is a caring, and it can be fun. A community built on shared resources can be extremely helpful to all the members of it. But that methodology only works when people donate at least as much as they take. Else supplies diminish and depression may result. Enter Supply N Demand!
If an item is more common in a Supply chest, its price goes down. Conversely, less of an item means more of a demand and therefore the price raises. This process helps balance out prices. As dirt will be common and abundant, it will be cheap; diamonds being rare and few in stock will cost a pretty penny.
Features
- Bring capitalism to your server
- Create "Supply" chests where items are bought and sold
- Prices vary by supply in chests; the more dirt is in there, the less its worth
- Scalablness of cost can be set in pricelist.yml or in game. (Higher scale number is more stable price)
- Prices are initially set up randomly. Edit them to your liking in the pricelist.yml or in-game.
- Supports all major economies (by use of Vault)
Requires
- Vault
- Some major Vault supported economy plugin
Permissions
- All players can access chests,
- Only OP can designate Supply chests and change prices
Installation Instructions
- Download file (Link to your right)
- Stick file in your "Plugins" folder
- Do the same with Vault, if you don't already have it, and an economy plugin.
- Start server
Commands
- /supply : while looking at a chest toggles it to be a "supply" chest or not
- /supply price [item] : checks the price of item
- /supply price [item] [price] : sets the price of item
- /supply scale [item] : checks scale of item
- /supply scale [item] [scale] : sets scale of item
- /supply stock [item] : checks amount of item in supply chests
- /supply cost [item] : checks cost of item (evaluated with current stock)
Permissions
No permissions needed. Only "Op" can toggle chests and set prices. All else if available to all.
Known Bugs
- None known
Upcoming Features
- Damaged items price reflects damage amount
- Enchanted items worth more (multiplier?)
- Permissions (if people care. Otherwise I will just leave it for Op)
- Open for other suggestions, let me know in the comments
Alternative: PrimeShop http://www.spigotmc.org/resources/primeshop.1113/ PrimeShop is an aspiring shop plugin, providing a dynamic price calculation algorithm built around the volatility of supply and demand. Items can be set to increase in price as they are purchased and decrease as they are sold back, simulating open market conditions. All item prices are perfectly balanced and correlate among one another. Items can be purchased by GUI, command, sign interaction or offered by a Citizens NPCs.
@n0trub
Unless I'm wrong, even with increased tax, if someone fills up a chest, then buy it back, they can still end up making money.
I think that the problem is within calculating price change ONCE per transaction. Instead it would have to change price after each single item (and not stack or whole transaction). That would require tracking items value with way more precise number if its not already doing so, I guess (in order to have low value / high scale items to actualy change their price), to first try the transaction without saving for real price changes in case player cant afford it and probly to lock up item types for other transactions or queue all transactions to avoid having 2 different transactions at same times with same items basing their calculs on the exact same price while one should influence the other.
@mannc3
I have struggled with a way to fix that same issue. The best solution I came up with is the tax, which is already in the plugin. But I didn't realize that dirt was that low of a break point. To change where that is, you can raise the tax or the scale value for the item, but I know that is not an ideal fix. Give me some ideas on what I can do instead; there must be some way to resolve this.
n0trub, love the plugin, and the idea is great! I do have the same concern about that buy/sell large number of items. I can consistently make a profit buying and selling a single stack. In fact, on dirt alone, the break even point is 61 items of dirt, if I buy and sell any more than that at once I can make a profit. So I don't think the 1 stack limit resolves the issue
@LHammonds
This plugin does not share any information with Essentials, so using the "/sell hand" would not change the prices in the chests. I would recommend disabling it.
The items are stored in the chest, so commodities like dirt and cobble will pile up quickly. On my server I have 1 chest dedicated to each, but on a larger server you may need multiple.
I hope it works out for you. Just so you (and everyone else) knows, I am working on making damaged items price scale with their damage, and that update should be fairly soon.
Thanks for creating and sharing this plugin. I am currently evaluating some kind of chest shop plugin for my server and this seems like a great fit. Instead of a bunch of individuals chests shops all over the server, I could setup one huge building for just about every item in the game and everyone sells and buys from it.
I have the essentials "/sell hand" command. Would I disable that in favor of using this system due to the variable pricing and availability?
I'm at the point where I need to stabilize the economy and jobs plugin so nothing is over-powered and I'm struggling on how to accomplish this.
Dirt and cobble tend to pile up easily. Are they "virtually" stored in the chest or is it limited to just the few rows available in a chest? Forgive my ignorance, I have not even installed it yet.
Thanks,
LHammonds
It's ok @n0trub its good to hear like Picty mentioned.
@n0trub
Good to hear it :)
After many months (like a year and a half or so), I have finally built an updated version of this my plugin. Its been completely re-written, so there are probably some new bugs to work out. But the good news is, Spout is no longer required. This is version 0.7, available to download now.
I added in a scale parameter for each item, so you can set the stability of pricing. As the formula still uses exponential decay, its a bit tricky to give a straight up explanation of how it works. Essentially, a high scale (such as 1000) will give a more stable price. Dirt, for example, needs a lot sold before the price drops much. Granted, it has a low starting price, but it won't deviate much from that unless you sell tons of it. A lower scale (such as 50) would be put on an item like iron blocks. This will make their price drop quickly when a few are sold in chests. But they are not traded as often, so unstable pricing makes sense. That is how I use it on my server at least; if you disagree, feel free to use different numbers.
Another improvement is the included price list. Every price has been hand set for what seems to make sense on my server. Yours will probably vary, but I felt this was a better way to send it out than with randomly generated prices. I'd like to thank @D_wight3207 for help with that list. Any items that are missing from your particular pricelist.yml file will be randomly regenerated. So, if you don't like the included ones, delete them and you will get random. Or just change it to what you want. Also, if new items are introduced in future versions of the game, it should automatically create a price for them (randomly).
Sorry it took so long for an update. If I even have any loyal returning users, welcome back. Hopefully I made it robust enough this time to not need more updates. But if it does, I will be more diligent about it, I hope. That is all.
can you make vault optional and say add the abilty to use xp as curency
@McJellyGooby
With the current methods available, no. With Bukkit, I can tell when a chest is clicked, and with Spout, I can tell when and what is clicked in an inventory and when an inventory is closed. It does not currently tell me where in the inventory it was clicked (being in the player or in the chest). I wish it did, as the way you are suggesting makes the most sense on how to run it. Maybe there is a work-around for it. Maybe.
And yes, the value is "StockWeight".
good to know about the power scale, that'll help. The weight value you refer to is the StockWeight parameter in the config file, right? to circumvent that exploit with price updating, would it be possible for transactions to be completed as each stack is placed (from chest to inventory and vice versa), rather than completing transaction when one exits the chest? That way, the stock price would update with every stack removed (or placed), and one would not be able to withdraw all of the stacks for 0.01 credits.
I am by no means a dev, so I cannot help on that end, but my scripting background helps me think of these ideas. My minions are still at work uncovering other bugs. Thanks!
@McJellyGooby
Wow, lots there.
I have the price scheme set up with an exponential decay. The formula is along the lines of: (base price)^(1-weight*stock) Where (base price) is what you set it to be per item, (weight) is as configured in the config file, defaulted to 0.001. Smaller values here mean the price changes less. (stock) is how many of the item is in stock at the moment of purchase. This is the best formula I could think up without getting ridiculously complicated. If you have a suggestion of a better one, I am all ears. I am not a business or economy major.
Both permission nodes and damaged items are on my list of things I want to implement before upgrading from "beta" to "release" status. They will be in a future update.
The tax imposed was to fix the buying and selling to gain money problem, but I guess if the stock is large enough, the tax wont be enough to fix that. nebenezer had suggested either an item stack buying limit, or a cool down time between buy and sell. What is your opinion on those options? or do you have another suggestion on how to fix that? The stack limit would be easier to add, but I think would be frustrating if you wanted to buy lots of dirt, for example, and had to keep re-entering the chest. Thoughts?
Thanx to you and your minions for finding the problems. I will work to fix them as I can.
hey there,
me again, thanks for fixing that hole so quickly. We have several stacks of dirt in our supply chests, and one player discovered that its price was 2201.59 instead of 0.75 credits per item. Would you please explain how the base price tweaking works (logarithmic scale, maybe)? Also, how am I able to adjust settings for this base price tweaking?
Would it be possible to create permission nodes for the various commands and access please? I need this functionality because I use a ranking system and I need to control which groups have access to each ability, especially blocking supply chest access to those I have on probation. I also want my mods to be able to control these supply chests but without getting the ultimate powers OP provides. Thanks so much!
while my loyal minions were bug-hunting, they discovered that an item with reduced price (large number in stock) can be withdrawn in large quantities without the price updating (going up) until one finished the transaction by exiting the supply chest. One then places those items back into the chest (with the raised price), resulting in a significant profit. This process can be used repeatedly to generate infinite currency. Sorry to dump all this on you, but I'm just passing along the news.
Good grief, yet another exploit was discovered, although this has nothing to do with your code, I'm sure. The plugin cannot read the health value of armour and weapons, so I check a chest to find a few diamond armour pieces with almost no health left. The player got full price for those items. Is it even possible for the plugin to interpret these secondary values? (health, etc). My guys will not stop trying to find security holes, trust me :P Good luck and I hope school is going well! Awesome plugin, and I'm eager to see more updates :D
@nebenezer
Sorry I didn't reply to your last comment. School has started again and my developing time has decreased. I have recieved the same errors on my server (null pointer exception), and found the problem, and will fix it tomorrow. Look for a new version.
As for your other suggestions you posted, if I made an organization plugin, it would be separate from Supply N Demand, though designed to work with it, so you could permission it how you wanted. Though I don't know if I will be making that. Proximity pricing could be done, and add an interesting twist, but I had designed this with a central bank location in mind. Opinions about this from other users would be good here. As for cool-downs and stacks limiting, I appreciate the idea but won't be adding those. If someone wanted to buy all the goods in real life as fast as they could, the prices would skyrocket. If they want to do this in the game, I don't see a reason to stop them. Again, thanx for the suggestions though, and the bug report, and for using my plugin.
After running this in my server a couple days I finally noticed it is filling my server.log with [SEVERE] errors. Considering you didn't acknowledge my last post I won't bother posting the log here. If you want to see it just let me know and I'll be happy to provide it.
@chrisknyfe
Because Bukkit does not have inventory close and inventory click methods implemented. They are under their "ToDo" list. So I use Spout to cover those. If Bukkit ever makes those methods, Spout will no longer be required, but until then its the only way I could make this work.
@Alrik94
The player that tried to open the un-openable chest can open a different chest, thereby unoccupying the un-openable chest. That is a workaround at least, i will work on a fix. Thanx for reporting.
Why do you require spout?
Ohhhh I found a bug. So, if you place something over the chest and right click it from the side, it will still think you are using but you aren't. Then if you remove the block from over the chest, and try to access it again, it will still say the chest is occupied. Can't unoccupy the chest :(
@McJellyGooby
The exploit has been repaired. Thank you for reporting it.