» 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 «
Could you update it to 1.4.6?
FYI, 1.3 does not appear to be compatible with CB 1.4.6-R0.1 (Beta Build)
Have you been able to address the issue with shift-clicking and getting the wrong amounts of items or emeralds back? If not... any way to disable shift-clicking the trade until it is fixed?
I've now put the Shopkeepers stuff into some wrapper, so you won't see any warning if you're not running shopkeepers too. Coming with the next update (1.3) these days.
Both, damage config and professions should be working fine. Just a little guess: Dig you too get the shopkeepers warning? I'm not sure how exactly bukkit handles registering the events, but if it stopped registering events on the classNotFound issue for shopkeepers, it may have missed some of those events regarding the damage stuff etc. If that's the reason, it will be fixed with the next update (1.3) too.
@ all: Since bukkit introduced some bigger changes to the import of the NMS classes making most plugins incompatible with the latest bukkit dev build or vice versa (updated plugins incompatible with an older bukkit version), I'm waiting at least for some beta to be released until I will update the plugin here.
If you're already running on the latest bukkit dev builds and so you already need an updated version, snapshots of the plugin can be found at http://ci.cube-nation.de
Why isn't this on dev.bukkit.org ?
I've been having trouble getting the config to work properly (offers seem to work fine) on 1.4.5-R0.2 with version 1.2 of the plugin. Setting "allow-damage: false" still let me hurt villagers and "allowed-spawn-professions: [1, 3]" didn't change the default spawns (I've been trying to get the 6th green villager type to spawn naturally with "allowed-spawn-professions: [1, 2, 3, 4, 5, 6]". Are either of these known issues? (I've disabled all other plugins to no avail). (my config file is here: http://pastebin.com/ha6mLgmi)
Aside from that, great job with this plugin!
If you don't have the shopkeepers plugin then you should probably expect to see this in the console. The Rebalance Villagers plugin is merely telling you that it couldn't find the shopkeepers plugin, therefore, didn't register with it.
Thank you very much for update!
Please fix this error-message on startup ;) 2012-12-09 03:26:41 [SEVERE] [Rebalance Villagers] Plugin Rebalance Villagers v1.2 has failed to register events for class com.hotmail.wolfiemario.rebalancevillagers.RebalanceVillagers because com/nisovin/shopkeepers/ShopkeepersPlugin does not exist.
Guys, thank you so much for picking this plugin up!
Looks great. :-) I left your some comments/questions in your commit: https://github.com/jnaset/rebalance-villagers/commit/39bc77cd03773e570093adfbd64cac7aba2064d6#commitcomment-2263633
Well, my first attempt was a complete hack just trying to get it running. Since then DerFlash did a really excellent job fixing the mismatched obfuscated method names (among other things!) My original intent was to run the plugin through MCP and keep unobfuscated source in git, however I have not yet been able to get MCP to work on CraftBukkit (and the plugin obviously won't build without CraftBukkit).
I took what was in DerFlash's GitHub branch and fixed an issue with the plugin not checking to reenable deals until the last deal got used - now the plugin will happily reenable an offer for you (as long as the config: remove-offers is false :-) It should also be more prompt about deleting them if remove-offers is true.
The shift-click issue remains - the server disables the offer partway through processing the stack (the client doesn't know about this) which is what throws the client and server temporarily out of sync. We could address that by adding 1 more to maxUses in a(MerchantRecipe) maybe?
Anyway, github link for plugin-in-progress: GitHub:jnaset/rebalance-villagers
As I'm into the project now I've copied our talk over to the ticket section, so we can follow it up there.
I think you're definitely on the right track, however in our testing we ran into really strange errors when shift clicking trades. Sometimes it would give us way too many of the item to be given to the player, then randomly disappear, other times it wasn't taking away the proper amount of emeralds.
After some time finding the best way to diff between the changes of WolfieMario and those from the bukkit update (1.3.1 -> 1.4.5) I finally found some nice way and could go through all the code for the villager replacement class.
So I cleaned it up a bit, updated it to be 1.4.5 compatible and also managed to understand the new vanilla offer removal method which has changed since 1.3.1.
So everything should now work as expected or even better. In my own tests everything did great so far. but for sure, I'd still recommend some more time testing it first. I'd still call it beta here...
As WolfieMario got be on board to the project I've now uploaded a new version which will come up shortly (still in review).
Thanks @WolfieMario for not letting the project die soon ;-) We should and will definitely go on with this great idea an opportunity!
@WolfieMario: Thanks for the open words. For sure you did great work here and making the project open source was the right decision, so people can go on developing it. If you later feel to pick up development again, this would be great, but until then we'll see if the community can work together keeping it alive! ;-)
Like I already said, I've fixed some timing/scheduler errors already. But after that I too didn't found enough time to update the villager class yet. With your comments and my actual JAD decompiled version of the class it should be possible without any big problems.
As I can see, @Crazysprocket seems to have made some progress too, so I also would be thankful for you putting up some GIThub repo/fork for this, so we all can work together on this and don't need to spend time on things already been fixed ;-)
Regards CubeNation / FlashIT
It's cool. You don't exactly owe us updates any more than you were obligated to make the plugin in the first place. I'd definitely appreciate it if you could pass the reins on to crazysprocket or somebody, of course.
Well that's all understandable, though I don't think you should let some asshole admins dictate how you enjoy your game. You're always welcome to hop around on mine. You won't encounter any BS like that on my small server, just an 18+ realm of smartasses, drunks, and iniquity.
Also, if you could at least help the guy trying to update it, its nowhere near usable. Causes server crashes xD
I'll make a confession: my original motivation for the plugin was selfish. The admins of a server I played on said they would remove villagers until some solution (be it a plugin, or a vanilla nerfing) came through, and I had spent weeks preparing specifically for villager trading (not to mention, I think emerald blocks look nice). With some encouragement from friends on the server, I decided to first come up with a 'fix' - that's the table of rebalanced prices I made. With more encouragement from friends, and with the admins saying they might use a plugin I make, I decided to learn how to create plugins, and set to working on this project.
The server owner said the plugin looked nice, and once Bukkit stabilizes they may actually use it. In the time I was waiting, I decided to add the configuration features (the ones which let you have fine-tuned control of the offers different villagers can make, and add custom villager professions). After a while, the owner stopped responding to my PMs, and ignored any discussion of the plugin or villagers ingame. After around a month of waiting, I got sick of feeling ignored, and called the owner out on the forums. Needless to say, the server admins decided they won't be using my plugin. They resolved that 1.4's changes were a good enough nerf for them anyhow... Although, they still haven't gotten around to returning villagers, but altogether I've lost interest in all of that.
I'm not sure if there's anything in particular for you guys to take away from that story, aside from the fact that I was selfish, impatient, conceited, and eventually lazy. I'd be lying if I said I don't feel disgusted at the whole matter, which is why I no longer wish to work on this plugin. Sorry for letting down the people who actually *did* appreciate my work :/
Well, now I feel like an ass. I'll admit I forgot about this plugin, and that I indeed have lost interest. I noticed it was still in my open tabs (over 30 of those at the moment); I guess that's why it says I've been "online every day".
What's the current state of things? Crazysprocket, you've been working on an update? Is there source available anywhere, such as the github? Are there any particular issues I can help with?
If anybody wants to take over, I can add them as an author here (that gives you the ability to make updates and edit the description, right?). There's probably also something I can do to give you developer/manager status on the github, right?
If it's even relevant to the updating of this plugin anymore, I dug up 12w32a's villager class, in which I annotated with all the major changes the update brought (at the time, I was anticipating updating this plugin, so I continued tracking how villagers worked). Needless to say, it's outdated, and method names likely don't resemble the Bukkit/CraftBukkit equivalents, but just putting it out there:
Anyways, sorry to disappoint all of you and basically abandon you like that. I'll keep an eye on this tab in case anyone has any questions that I can help with, but I don't think I'm interested in going back to developing it - it seems somebody's saved you from my stupid carelessness anyhow. Also, finals week is coming up (and with it, assignments which are worth double the points to compensate for school time lost to hurricane Sandy), so I can't say I'd have the time to spend hours on this like I did back in the summer, even if I had the will to do so. Who knows, in the future I may take interest in developing plugins again, but I don't forsee really returning to this particular one.
Crazysprocket, your version of the plugin is causing the following crash:
Superb, thanks! One question: If a deal is currently disabled by MC can it be salvaged by trading the next level of deal with the villager (the vanilla method of re-enabling a deal)? If so, will the deal remain re-enabled permanently afterwards?