UVVillagers
Note from the author:
This was my first plugin, built for use on the survival server I run for a few friends. It's far from the robust village infrastructure I originally envisioned, mainly because I didn't want to completely rewrite all of the core minecraft village code and villager behavior... but I think it accomplishes enough. Since it reached a point that I'm fairly happy with several months ago, most of the time the only updates I do are to address major bugs or bukkit upgrades.
This was also my first foray into Java. As such, the code can be a bit of a mess in places. If you want to poke around to see how I did what I did, or fork it and add functionality (or fix bugs!) check out the git repository on GitHub. You might have to poke me extra hard with pull requests merging functionality back in unless I'm expecting them. And hey, if you've looked at the code and aren't completely turned off by it, a co-maintainer would be welcomed to the project. I'm sure some of my users would appreciate your contributions! ;)
- James
The Goal
To make NPC Villages (and the expansion and defense thereof) a more integral part of the game.
Installation and Documentation
https://github.com/jcornwellshiel/uvvillagers/wiki - Lots of details here, and it's almost up to date! Go go go!
Important note on bukkit versions:
This plugin hits core minecraft classes, and thus can be only run on the appropriate bukkit versions. You can't use UVVillagers for CB1.6.4 on a 1.7.2 server, or vice versa. Starting January 2014, if there is not a recommended build for the latest minor bukkit version (for example, at the time of this writing, 1.7 only has dev, alpha, and beta builds available) I will publish two copies of this plugin for each update I do:
- One for the current Recommended Build (Currently 1.6.4-R2.0)
- One for the most stable recent build (currently Beta 1.7.2-R0.2).
If you need more than this, feel free to contact me.
Basic Features
- Player popularity tracking with villages.
- Greeting displayed on entering villages.
- Receive daily tributes from villages that you maintain and defend, based on population and popularity.
- Extra-awesome zombie sieges.
- Rewards for defending villagers from zombie sieges.
Details
- Villages: Villages expand the core minecraft NPC Village functionality to include:
- Villages are named after the first player to discover them (after installing the plugin), and can be renamed by whomever is most popular with the village.
- Per-village-per-player reputation, broken down into configurable tiers.
- Information about physical size, population, etc is reported to users.
- Notifications are displayed upon entering a village, a village being abandoned, etc.
- Commands to get information about villages are accessible via /uvv
- Villages will pay nearby players a configurable daily tribute every day at dawn based on the players' reputation and the village's population.
- Sieges: Zombie Sieges expand on the core minecraft Zombie Siege functionality, and are strongly enhanced and configurable.
- Any mob can potentially spawn. Yes, including withers and ender dragons.
- Siege statistics are tracked, and killing mobs that are part of a siege grants reputation with the village under siege.
Currently working: (version 1.3.8)
- Citizens support
- Configuration files! (All values and % chances can be changed!)
- Configurable messages!
- Village population and reputation announced upon nearing a village.
- Zombie Sieges can spawn all sorts of crazy stuff.
- Override core Zombie Siege mechanic in favor of ours.
- Spawn a siege on-demand.
- Village-Player reputation tracking
- Villager tributes! (Player receiving tribute must be near the village at exactly dawn)
- 0-3 emerald tribute per 20 villagers in nearby villages every day at dawn.
- 1 emerald tribute bonus per 20 villagers.
- 1-2 emerald tribute bonus per zombie siege kill during the previous night.
- multiplier based on current reputation
- Dynmap support is now integrated
- Multiworld support
- Some prevention of typical zombie siege avoidance tactics (like using floating platforms) by spreading spawns out over a radius.
- Can now select items other than emeralds for tribute!
- Collecting tribute from a mayor instead of it magically appearing (requires CB 1.5.1)
- Set whether tribute is collected from the Mayor or appears directly in your inventory
- Configurable minimum village size
- Preventing villager purchases if your reputation is too low
- Iron Golem aggro on extremely low reputation
- Overriding core popularity effects (cancel iron golem attack if it's caused by your reputation being too low)
- Chest tribute
- Better mayor retention
- Server-owned villages with /uvv setserver
Known Bugs
- Null exception thrown for some people using dynmap (properly caught since 1.2.5, still not sure of root cause... for some people dynmap is returning null when creating new markers, even though the marker is created)
- Mayors sometimes teleport into occupied blocks, suffocating them. This might be addressed now.
Enjoy! Post your bugs, exploitable aspects, and suggestions in comments here or at the GitHub repo !
I've been getting zombie sieges, which is fun, but they are invisible which is not fun as I cant see them to kill them. I saw the potion chance buff thingy and assumed this was the problem so I altered it to 100 (hopefully giving 0% chance). I am still finding the little meat infectors hiding and turning my money... I mean villagers into zombies.
Is this a bug or just the way its supposed to be ? Can it be turned off?
Is there a way to remove the reputation loose every 20 seconds when you are too far?? And to remove the midnight siege? Oo
Small bug with siege mob potion buffs in 1.1.13. Edit your siege.yml and set potionBuffChance to the opposite of what you'd think it should be. (e.g. - if you want a 5% chance, set it to 95%).
Apparently I can't tell the difference between > and < at night.
@Xikage
Improving the custom messages is on my list. Right now the messages aren't very forgiving when it comes to editing... and I'm a dummy so I don't have it checking the so if you edited the language.yml file it's likely the cause of the error. That particular error is from the siege_began message. Make sure it's got exactly one instance of "%s" in it.
I'm gonna be updating that to handle actual placeholders (like %name%, %coordinates%, etc) in the next update.
Love all the stuff you've added. 1.1.13 is occasionally throwing the following error though, not sure what the cause is: http://pastebin.com/cxr6FPWN
Could you add support for colors and formatting in the language file? :D
@jcornwellshiel
I've noticed the core village splitting issue several times now, seems to happen pretty often with very large villages. It can get very confusing for players!
So I encountered an annoying thing tonight - my core village split into two core villages after the village center shifted about 50 blocks at once. This caused a new UVVillage to be formed as well (since I use core villages as the basis of UVVillages).
Nothing I can do about that, that I know of.. but it wreaks havoc with my plugin's village handling. After a while they merged back together. I may have to allow a UVVillage to contain multiple core villages in instances like this (if the additional villages are within a certain radius of the original village) or at least provide automatic UVVillage consolidation when multiple UVVillages end up attached to the same core village. I'll toy around with it more later... hard to reproduce some of this stuff.
Anyway, just thought I'd share. Little things like this constantly plague me. It'd be nice to actually know what to expect the core village objects to do...
@Wedhro
Excellent. I can probably add those into the 1.2 release, as I'm not sure I'm going to get the new tribute system in place by Friday.
@jcornwellshiel
The permissions in the wiki and the other two you just mentioned seems fine to me.
@Wedhro
I've got a few things going right now, but I'll see what I can do for the permissions and default rank setting after I've got the 1.2 release stable for release Friday. Both should be relatively easy to implement. I've been trying to figure out the best way to accomplish some of the other goals and it's been distracting me from the little (yet equally important) stuff.
Other than the permissions here: https://github.com/jcornwellshiel/uvvillagers/wiki/Permissions can you think of any that you'd want? Off the top of my head would be: - uvv.tribute (receive tribute) - uvv.reputation (use UVV reputation instead of core)
What about supporting permissions for the reputation system, commands and so on?
EDIT: Oh, I also have a simple suggestion: an option to assign newly found villages a random reputation rank so, for example, you could find a hostile village or one which worships you as a god at first sight!
@bubblybill
I was actually contemplating something like this earlier today, though the sieges alone should limit a little what they can manage. I'll add it to my to-do list as an option.
I was wondering if it were possible to add a function to limit villagers from spawning. The reason I ask, some users on my server built a villager farm to produce Loads of villagers and inturn a golem farm to get iron.. I dont want to stop this from happening but just want to make them work for it. I was hoping for something like a "village chest" which must be filled with food items. The chest would remove some food daily depending on the amount of villagers in village. So you can have large villages, but you would need to balance farming to support your villagers.
If the food ran dry... possibility of villager deaths from starvation.... no tribute from villagers whilst food low .. etc etc.
Farming by day, zombie kicking by night.... Keep the emeralds flowing !
What do you think ?
@Xikage
Currently the method for detecting whether a village is abandoned is as follows:
Every 5 seconds we step through the UVVillages and check the following:
A UVVillage gets a "strike" if all of those are true during a check, and is abandoned when it gets 2 strikes in a row. Strikes are reset if any of those criteria are false. So it should only abandon a village if it *should* have be loaded for over 5 seconds, but wasn't.
Core villages appear to only be loaded if a player is near them, regardless of whether their chunk is loaded.
There are a few things I changed in 1.1.7 (not uploaded yet) that may reduce false positives. I've updated to 3 strikes (minimum 10 seconds) to prevent slow logins from abandoning villages, and I've changed the method by which I detect whether a village is loaded (instead of using the core getClosestVillage() method I'm finding the nearest village manually).
1.1.7 also adds a minimum village size (default = 1).
I should have it posted later today.
@Xikage
That's doable, sort of. I can't control what core considers a village, but I can add a minimum population for UVVillagers to notice it.
Could you add an option for a minimum number of villagers before something is considered a village? My server uses Shopkeepers among other things and often times there will be all sorts of single-villager villages popping in and out of existence all over the place. It would be nice if there were an option to not consider something a village unless it has, say, 5 villagers in the area.
Also, a kind-of fix for Citizens NPCs causing villages to be detected as destroyed constantly is to check if the chunk is actually at the player's location before checking for villager count. Citizens NPCs do not load chunks around them by default which can cause all sorts of weird behaviors with plugins like this...
@Xikage
It's in the works. I'll be adding two things once I've fixed multiworld support: an option to change from emeralds to another item, and a configurable tribute mode based on the professions of the villagers you have (blacksmiths will give certain items, librarians others, etc)
I didn't see this posted anywhere, but could you add a simple option for changing the tribute reward to something other than emeralds?
Really love this plugin! Excited to see where it goes, keep up the awesome work.
@lawrence1998
I actually made a point to go around admin claiming them with GriefPrevention and then fixing them up, spent way too many hours doing it
Seems cool. I always hated how NPC vilalgers would always die and my players would grief their homes.