Rebalance Villagers
» If you like this plugin you should definitely check out our other plugins too «
Rebalance Villagers
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.
Other Features/Conveniences
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!
Dev Builds
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.
Special Thanks
- 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 «
Got the plug-in working with the latest dev builds of CraftBukkit.
I still need to fix a few more things but this might help get people going for now: rebalancevillagers.jar
Known Issues:
What is the process for reporting an inactive plugin? I'd like someone else to update this. Seems Wolfie, despite logging in almost every day has lost interest.
@LordKainzo
You can define every item a villager may offer/buy, so yep! :-)
@finamenon
They fixed some things first. I didn't find the time yet to update the RebalancedVillager Class itself, because that one is kind of a copy of the original Villager Class with some changes and so seem to need an update for the 1.4 changes now.
Can this block enchanted items from being gained from villagers?
You out there, WolfieMario? We kinda need some help, here.
@CubeNation
Are these actually making it compatible with patch 1.4? Or is this just added features for compat with another plugin?
Actually made some first modifications here: https://github.com/DerFlash/rebalance-villagers/commits/master
If I can find some more time to finish this up, I'll send a pull request to Wolfie for sure
@zeta0134
Oh god please do. The author WolfieMario has been ignoring PMs despite being online just about every day. Whether he is busy or what I don't know, but this is the only plugin that needs to be updated in order for my server to run the next patch :D
Looking at the source code for this app, it seems to extend the Villager's class (straight from bukkit, which itself is nearly straight from Minecraft) and make modifications to a whole bunch of functions. My guess is, it broke with the new patch because the code for offer generation is changed significantly, which would be breaking villager spawns (as they start off with a single offer).
I don't know enough about either codebase (mojang's or this mod's) to make the necessary updates myself, but if I have time this weekend I'll dive in and see if I can't figure out what needs to be changed. It should be minor updates, as the major changes to villagers include a new offer disable system (instead of removal) and a like/dislike system which shouldn't be interfering too much.
I'm not seeing any sort of official API for dealing with villager trades (I assume it would be on the Villager class?) in Bukkit, so it looks like there's no cleaner way to implement the mod. We'll just need to do the dirty work to update it for now.
so, what about the plugin.. any updating going to happen? or should i look for something else...
the plugin broke on 1.4.2, completely stopping villagers from existing/spawning
@EDSman11
Well, my plugin does not support fully disabling offer generation for any profession, as there is always a default. The best you could do is create a villager profession with a guaranteed offer of something nonsensical that players can't complete (e.g. buying bedrock for bedrock. Don't make it an offer to buy/sell air, however: players can be crashed by such villagers and find their items deleted!). As the dummy offer is guaranteed, the default offer will never occur for that profession. Now, unfortunately, all custom professions look like the unused green villager, so you can't make your non-trading villagers look like other villagers with my plugin.
Anyhow, if you have MCEdit, you can get Sethbling's Change Mobs filter, and select villagers in MCEdit to change their profession. However, I think it only allows for the default professions, plus profession 5. If you wanted something like profession 6 or any other unused profession, I don't think Sethbling's filter can do it.
Your other option is to spawn the villagers with my plugin: If your server's not busy, and you can afford to make it unavailable for a moment, you can go to config.yml and set 'allowed-spawn-professions' to the ID of the unused profession you want, e.g. [5]. Now, when any villager spawns (including via spawn egg) it will always be that profession. Of course, remember to change the setting back to normal after you're done :p
You could also try the Shopkeepers plugin, as it'll probably save you a lot of headache. With it, you can spawn a shopkeeper anywhere, and by default, they will have no offers and will not generate new offers. Now, you have to go into that plugin's settings and make sure it doesn't disable trading with normal villagers, otherwise your players won't be able to trade any normal villager! Finally, there's one downside (which may not be a downside, depending on what exactly you want): the shopkeepers created by the Shopkeepers plugin do not walk around.
Sorry if none of these options are ideal. I was actually planning to add a command to spawn villagers of any profession, but I'm too busy with school now.
Hi, I need to create a few villagers for show that do not sell anything. I still want the normal villagers to sell as they normally do. Could I use this plugin to create a profession that doesn't sell anything then use a world editor to spawn it in? If this would work which world editor would I use to do this?
Thanks, EDSman11
@ljmc01
Wait, what do you mean? This plugin already lets you edit what villagers are willing to buy/sell, and what currency they use. That's kind of one of its main purposes. See 'offers.yml'.
Or do you mean something else? If you want to edit specific villagers in-game, I recommend the Shopkeepers plugin. It lets you create villagers that operators can customize with an ingame GUI.
I don't think I'll ever add editing of specific villagers to my plugin, as my plugin has always been for changing the defaults of villagers, and Shopkeepers has been for editing individual villagers. Really, I think the two go excellently together, and I've gone through the special trouble of making my plugin compatible after people brought it up :p
@MattSheridan
To be honest, I don't feel like adding more items to the spreadsheet until villagers indeed begin trading them. It actually takes me quite a bit of consideration to value a single item - especially if it's not a product of items that already have values.
If you're interested in the process involved, basically I work left-to-right across the columns. For example, to determine the rarity-based value of lapis ore, I'd compare its rarity in generation to that of gold ore. Also, I would figure out the value of lapis ore before I tackled lapis, as lapis is a "product" of the ore (this is the same reason I placed a value for ink sacs: to determine the value of a written book).
PLEASE REPLY I think it would be really cool if this pluggin allowed operators to edit what villagers BUY/SELL. I want this because then you could set up a realistic marketplace were people buy and sell through a currency e.g gold. Also i came across a pluggin that actually made a new item with gold and silver coins this way you could have market places were the villagers trade with real money. Either way I think this would be an awesome way to do iconomy and I really hope someone reads this and try's to make this a pluggin!
@WolfieMario: Have you considered adding other blocks and items to the spreadsheet? I'd be really interested in how your system values various things that the villagers don't already trade in, like lapis lazuli, or Nether wart.
@Marcus101RR You can. It's too late for me to set up my server and test it, but the following should work:
That belongs in the 'other' section of the villager class that you want to sell it. "speed-II-potion" is just a name so you know what the offer represents - you could change it to "lolSomething" and it would still work.
Potions store their type as a damage value, which is why you need to specify it like this (8226 is a Speed II pot's dv). For reference, the Minecraft wiki has a page which provides the damage values of each potion. You may also benefit from the Data values article if you require any other unusual items.
Good luck, and let me know if that worked :)
You should allow Potions to be sold too, or atleast I can't figure out how I can sell them Potion Speed II or something...
Finally managed to set up a Github for this - the project's now officially open-source! https://github.com/WolfieMario/rebalance-villagers
...That was surprisingly difficult.