» If you like this plugin you should definitely check out our other plugins too «
This plugin allows you to configure a detailed collection of game mechanics pertaining to villagers. Its most notable feature is complete control over the offers which can be generated - by default, it also starts with an extensively reworked set of prices to make trading dramatically less abusable while still allowing it to be profitable (more on that later).
This plugin's default settings may be enough to repair the currently exploitable villager trading system - however, in case you want your own server to have a few special touches, so trading can be balanced perfectly for it, this plugin allows you to adjust the following:
In config.yml, you'll find general settings:
- Control over offer removal: You can choose how many times an offer can be traded before being removed, how long it takes for offers to be removed, or simply disable offer removal altogether.
- Control over offer generation: You can choose how many offers a villager starts with, how many offers are generated at once, how long it takes for offers to be generated, whether villagers generate offers after any trade, and what the chance of offer generation is.
- General trading settings: You can control how long the decorative particle effect lasts when villagers add/remove offers, choose whether players can trade with villager children, and choose whether players can squabble over villagers by letting them kick each other out of the trading window.
- General settings about villagers themselves: You can specify their max health, make them invulnerable to all harm, and choose which villager professions can spawn naturally.
- There are also some technical settings related to using this plugin with Shopkeepers, but once full compatibility between Shopkeepers and this plugin are established, these will be removed (these settings don't do anything magical; you won't miss them).
In offers.yml, you'll find settings to control the offers villagers can make:
- You can define your primary currency item, which will be used by all non-custom offers you include - it can also be used in your custom offers, for convenience.
- You can define all of the offers which can be generated by each villager profession, and the offers which get generated by default.
- You can define offers for your own custom villager professions (which can be spawned with world editors, or by editing config.yml to allow them to spawn naturally). The number of custom professions is virtually unlimited (unless you want more than 4 billion), but they all appear identical to the unused green villager.
- You can remove existing offers or make them never generate.
- You can define offers as 'buys', or 'sells', to use an existing table of prices, or 'other' to create custom offers.
- Custom offers give you full control of the two input slots and output slot, allowing for offers which don't use the currency item, offers which provide random or specific enchantments, offers with any damage value on any item or block, and almost any type of offer a world/NBT editor could create (the only thing you can't do is have offers which provide books containing specific text). Note that item quantities and enchantment levels can be randomized, too!
- You can control the values in the tables of prices, used by non-custom offers.
All of these features are explained in detail in the config files. In fact, offers.yml has a sort of "tutorial" on how to edit it.
By default, this plugin...
By default, this plugin disables the vanilla system of offer removal, and changes the offers which villagers can generate.
No offers are added or removed, and the chances of offers are also the same as they are in vanilla Minecraft. However, pricing has been extensively reworked, based on my work in this thread. Basically, I have created a chart which carefully balances the values of items based on many criteria, geared at producing a far more sensible and less exploitable set of prices than the vanilla system.
The reason my plugin disables the offer removal system by default is because, aside from many players' complaints, this thread explains why the system makes trading unusable without exploitation. Just as my defaults are intended to reduce the potential for exploitation, they are intended to reduce the need for exploitation.
If you wish to start with vanilla Minecraft settings, simply copy the contents of "offers-vanilla.yml" into offers.yml, and see the top of config.yml for vanilla defaults on offer removal.
First, alongside the detailed explanations in config.yml and offers.yml, you'll be happy to know my plugin has a load of failsafes packed in. If you configure it incorrectly, the plugin will not crash (unless you make the config files unreadable!). Instead, it will choose some value which allows it to safely run (for example, if you specified a number as 0 when the lowest accepted value is 1, the plugin will use 1 instead). Now, you may be thinking that's a bad thing, but the plugin will let you know when this happens:
Warnings will only appear when you've done something incorrectly in the config - otherwise, normally the console doesn't get spammed ;)
Also, if you leave a value out of the configuration, the plugin will usually revert to a default - but don't make a habit out of this :p
The vanilla generation system doesn't allow you to earn more than one emerald from selling an item, unless you manually specify a custom offer - despite being able to specify offers which *give* more than one item in exchange for one emerald. My plugin fixes this, making the buy and sell values tables formatted the same way. Thus, it's easy to make offers like this one:
Probably my most convenient features in this plugin are Smart Stacking and Smart Compression. Let's say you want a villager to sell a diamond helmet for 98 emeralds. A player can't place more than 64 emeralds in one slot, and Smart Stacking realizes that. Smart Stacking will automatically do this for you:
Smart Stacking basically makes 128 the maximum amount of an item a villager can accept (warning: Smart Stacking is currently not smart enough to realize certain items do not stack or stack only up to 16. For this, I'm afraid you'll need to make a custom offer, but that's not difficult).
Sometimes you need a villager to take more than 128 of an item, and that's when Smart Compression comes in. Here's how an offer requesting 129 emeralds is handled:
If you were to convert those emerald blocks into emeralds and add the rest of the emeralds to it, you would see the total is indeed 129. Smart Compression effectively increases your maximum up to 640: a stack of the compressed item, and a stack of the uncompressed item. Also, Smart Compression works on emeralds, diamonds, gold ingots, gold nuggets, and iron ingots, all of which can easily be converted into a compressed form at a ratio of 9-per-compressed-item and likewise converted back - thus, you can set your currency item to any of those items and rest assured that Smart Compression will still apply.
Using My Chart to Balance Trading Yourself and Exporting the Results to Your Configuration
I suppose this is also a convenience/feature, but it deserves its own section. Remember that chart I mentioned earlier? It can be downloaded here, and is fully interactive.
The only cell in the chart with a value not calculated from other cells is the gold-colored cell next to Gold Ore. It's a sort of "gold standard", if you will, which determines how much emeralds are worth. Double it, and emeralds are halved in value. Halve it, and emeralds are doubled in value, and so on. The rest of the chart will update with your changes.
If you don't want to use emerald as your currency item, you can choose an item you do want to use. If it's in the chart, find its value in the "Adjusted for Usefulness" column. This column is bold because it represents the actual worth of that item in emeralds. Now, take that number and invert it, and place that inversion in the golden cell (so, to set the currency to diamond, you would put 1/17.7999 into the gold cell). If you did this correctly, the "Adjusted for Usefulness" of that item should read 1, as it is indeed worth one of itself. All other cells in the chart have been recalculated in value, and are now priced in that item instead of emeralds.
You can make any other changes to the chart by editing the formulas of its cells, or editing the special variables to the right of the chart (the "Modifiers" column, U).
Finally, look for "Rebalance Villagers Plugin", cell AC1. Around there, there are four cells (in the "Copy this code into offers.yml" column) which you must copy the contents of into offers.yml. The proper destinations of each are specified in AC, while the actual values to copy are in AD. Simply copy these in, erasing the unwanted original values in the process, and the plugin will new use these values.
Note: If the cell AF6 says there are errors, please look in the column V ("Valid Offer Checker") for what the errors are. These errors are when invalid offers are created, for example offers which are impossible to complete (requesting more items than the player can put in the input slots), offers which would produce impossible item stacks (e.g. stacked tools), or nonsensical situations such as a villager providing items at a cost of zero emeralds. So remember to make sure there are no errors reported in AF6 before you copy the config outputs!
Oh, and if you changed the currency item in the chart, be sure you change 'currency-item' in offers.yml too!
You can always find the latest snapshot in the Jenkins.¹
Github Source Code
The source code of this plugin can be found here. It's my first plugin, so feel free to let me know if I've done anything horribly nooby :p
If you would like to contribute to the plugin, you may use Pull Requests. Add yourself with an '@author' in the javadoc tags of any part you create or substantially modify - you can identify yourself with whatever name you like. Of course, I will publicly acknowledge that you have contributed to this project.
- WolfieMario, the initial creator of this plugin: thanks for the whole idea and opportunity with this great plugin and thanks for all your work you've done here!
- nisovin, the creator of the Shopkeepers plugin: thanks to him/her making Shopkeepers open-source, WolfieMario could make the plugin compatible with his and rest assured that he's not doing anything horribly wrong in the code.
- Icyene, for pointing WolfieMario in the right direction when he started - without his good deal of help, he would have had no clue how to start coding this plugin.
¹ Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk.
· · ·
» Powered by Cube Nation «
That seems like a great idea, as I've just gone back to school and no longer have nearly as much time to work on this (from my SVN I gather it took about 47 hours of coding and testing just to get to this point), and I'm certain most people here would be more experienced at making plugins than I.
Of course, I won't stop working on this, but I don't think I'll be adding anything much until the 1.4 update.
I'm not familiar with using Github, but I'll try getting that set up.
The changes actually apply to all villagers, but they don't apply to old offers, as there's no efficient way to tell an old offer from a new one (you'd have to iterate over the list of possible offers and check if it falls within range of one). Although, a command to clear all offers of all villagers in the world would be quite useful: it would solve the issue you describe, without actually killing villagers (however, it would also potentially wipe good offers, and as such should not be used too often).
I'd like to add that, but when I add the Github, anybody can try if they like.
I have notieced that the changes only apply to new villagers maybe there should be a way to kill old villagers or apply the changes to old villagers as well
Maybe you can put the project on github so people could help adding freatures using pull requests? I'd love to help.
I've modified my chart. I fixed a few bugs in the "NPC Trader's Price" column, and added a warning feature that lets you know if any offers are invalid (e.g. impossible to complete or producing items stacked higher than they normally can be). That feature should make it easier to use the chart, as you don't have to manually check that all offers are valid.
@FlashIT I've enabled tickets, thanks for letting me know.
I like your idea, although I'm afraid I don't exactly know how to go about doing it. The last time I checked, the player class would potentially need overriding in order to change the outcome of a trade - and that's a can of worms I'm not keen on opening. It may be possible within the API using events, but I'm not entirely sure.
At any rate, school has started for me, so I'm afraid I probably won't be developing much more of this plugin until 1.4 comes (as 1.4 changes trading mechanics quite a bit) :(
@Dzhalagash If you want custom damage values, you need to make a custom offer. Also, I think the proper dv for enchanted golden apple is 1, not 2. 0 is the default apple. Put the following in your desired villager profession's "other" list:
How to make the villager sell enchanted golden apple? Golden apple is 322, enchanted I've read about 322:2 though it may be wrong ("/give player 322:2 n" doesn't work).
btw... would be great if you enable the ticket feature of this project, so bugs/feature requests will not be overseen.
Here's a request: if villagers are set up to pay more than 64 emeralds for diamonds, they will ask for the diamond and offer for example 65 emeralds. If I then put in the diamond, it just pays 64 emeralds (instead of the 65). Since I'm not able to put the 64 emeralds back, it would be easy to just pay out the rest directly to my inventory.
Just wanted to let you know that we've successfully integrated your plugin into our new economy system on our main server (130+ regulars). Due to the missing permissions (see my old comment below) I've just written this little feature by myself and so far everything works great with both, Shopkeepers along with your Rebalance Mod.
Thx a lot and PLEASE keep up the great work!
Probably the most important trait of a good programmer is about how he documents the files, and the documentation is perfect, GJ.
Awesomeness. Keep up the good work! Rebalance Villagers and Shopkeepers together is just what the game needed.
A couple things tho: I think it's Vault that's making duplicate villagers after reloads. I took Vault off and now it's working ok. When reloading, I notice the villagers will duplicate for a split second, and then revert back to a single normal villager. Also, I'm getting issues where villagers are selling 2 gold ingots for 1 emerald, even though it's not even listed to sell 2 for 1 in the offers. I found that it's due to adding more buys and/or sells under the potential-offers. I've also listed the buy/sells on the bottom in the buy/sell values too.
Thats what I meant. How many ways are there to get Iron Ingots? Just Mining and then smelting. So you need to find an Iron ore then smelt it with Coal so you need two Items to make one. And coal is very valuable if you consider that you have epic buildings with lots of cleanstone, glass or bricks on your server. You need coal and iron for so many thing in Minecraft that it is as valuable as one Emerald. You can also trade 3 coal for one Emerald witch in my eyes needs a small adjust. If you still want to change the Iron Ingot sell value then just search for "ingotIron" and change the number in the .
You can buy one Emerald for ONE Iron Ingot. They aren't selling the Ingot, they're BUYING the Ingots.
Because you need Iron for a lot of things in Minecraft. If you have Ironbar drops disabled on your Iron Golems (what you should in my opinion) then Iron is a very valuable thing in Minecraft.
Erm...if this was "Well thought" and "Balanced" why are there frequent Villagers selling 1 Emerald for 1 Iron Ingot? :P I can't find in the offers.yml where to get rid of that offer for good, or to increase the Iron Ingots.
I have worked with Icyene a lot before, in fact, we chat every day on skype. Icyene is a he (haha).
Wow, I've looked at the config/offers actually of the 1.0 and I'm absolutely impressed! Seems like you've put a LOT of thoughts in there :-)
Some questions: Did you change the offer values lately or is it still based on your calculations? What's the easiest way to get your actual excel table into a proper format after chaining some values there? Just copy'n'paste to the right place or is it even easier?
Theres only one thing actually what our server would still need: we'd like to put useable villagers just into one world (trading world) while "disabling" them within the others. This could be achieved using another plugin like http://dev.bukkit.org/server-mods/villagerperm/ But then there's the problem that ShopKeepers won't longer work there too, but they still should.
So the best thing which came into my mind would be to have some permission for this plugin where users can use those "normal" villagers and so disabling them within the rest of the worlds + still enabling to buy from shopkeepers anywhere. Shopkeepers already has a permission for creating them (which can this way be set to only a specific group and world), which should be what we need. This way the users could also still have their own "unusable" villagers within the other worlds.
Wow, thank you :)
I'm glad you liked my method. This is pretty much the first time I've used a spreadsheet to extensively balance things, but I think even I'm going to reuse the concept in the future for unrelated things, now that you mention it :)
Oh, make sure you get the version from here - the Download button links to the old version (I think the new one needs approval or something? I'm a bit new to this system).
The old one doesn't have Shopkeepers compatibility - if you run the old one together with Shopkeepers, you get normal villagers in place of shopkeepers. The shopkeepers aren't lost, and will come back after you remove the old VillagerTradingRebalance.jar, but you'll end up with a duplicate villager for every shopkeeper that was in a loaded chunk while VillagerTradingRebalance was running.
If you run with the new version (which I've since renamed RebalanceVillagers.jar, as the project's changed a bit), it will have compatibility with Shopkeepers and won't do anything bad*
.*There is one issue I'll be sorting out with the creator of Shopkeepers: currently, if you have Shopkeepers, Rebalance Villagers, and a third plugin which can spawn villagers, and you use the third plugin to spawn a villager while your server is lagging, it may cause a crash. Otherwise, in practice it's a very rare bug, but I'll try getting that sorted out.
Thanks for this, this is exactly what stock villagers need right now.
Shopkeepers compatibility is fantastic because I already can't live without that plugin, and now I'm able to use both of these essential plugins. :)
Alright, finally version 1.0 is out, complete with Shopkeepers compatibility, full config of offers, and a load of new options. Check the config.yml and offers.yml; each has detailed descriptions of all properties. I'll update the description when I'm not ready to collapse.
Thanks, all the supporters, and goodnight!
EDIT: Oh yeah, and I'll test it for compatibility with the latest RB tomorrow too.
I just want to say that I think this plugin is an excellent idea, and that you seem to be handling all this stuff brilliantly. The value spreadsheet displays admirable methodology, and I think it will be invaluable for plugin developers and server ops balancing totally unrelated plugins.
Interesting tweaks. While it's entirely valid to shift the value of emeralds, though, I'd like to mention one thing: Jeb has explicitly said you're not meant to go mining as your main source of emeralds. He said he put emerald ore in as a 'nice find', and that trading is the intended way to obtain them. This is why emerald appears in veins of 1 and is so spread out - it's not something you're meant to go looking for, it's something you're meant to come across.
Also, you've got to watch out: my chart rounds numbers to the nearest value, hence written books sell for 0-1 emeralds, and flint and steel and leather boots can be bought for 0-1 emeralds, and iron shovels cost 0 emeralds. That's always an issue when you raise the value of the currency: even if you round these all up to 1 emerald, it's not that logical: you can get iron boots and leather boots at the same price, and all iron tools at the same price.
Anyways, I think I'll upgrade my chart after I finish updating this plugin. It will be able to generate the text needed for a functioning offers.yml, thus letting you go directly from this chart to a working plugin, configured to all the values you need. However, it will still be your responsibility to make sure there aren't any zeroes or anything above 128 (except emeralds, which safely go up to 640 thanks to the plugin calculating when emerald blocks are needed) :p