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 !
Thanks for the 1.6.1 update and your response to my last comment.
I moved the Minecraft server software to a used Dell PowerEdge 840 Xeon X3210 2.13GHz with 4GB memory and I don't get PlayerInteractEntityEvent errors anymore. So it looks like the error was a due to my computer hardware being too slow and not having enough memory.
Since moving the Minecraft server software to the new computer: The mayors have been disappearing more often... Which in a way is a good thing, because the village that had two mayors... they are both gone.
I have the server setup so that the villagers can't be killed (I think in the Essentials or Worldguard plugin). So I don't think they died, I am guessing that the mayors reverted back to normal villagers.
Anyway... the villages are still the most popular spot on the server, thanks to your UVVillagers plugin. Keep up the good work!
Spigot 1024 (Minecraft 1.6.2) and UVV 1.3.0 (even though it says 1.2.5): http://pastebin.com/rH7uZNUw
Made a quick update for 1.6.1 this morning. With any luck in the next couple weeks I'll have time to address these bugs.
Sorry for the radio silence, guys. Been quite busy.
@Gilder559 I'm looking at reworking some of the mayor stuff. As for finding new villages... I'm hooking the core minecraft villages. You could try lowering your tributeRange in config.yml, as UVVillagers uses that to detect the nearest core minecraft village, but it should still be detecting a new core village appopriately...
As for the double mayor... kill one. It happens sometimes at the moment, especially if the mayor is allowed to walk around, and I'm not quite sure how or why (most likely due to village geometries changing when chunks are loading/unloading... core minecraft villages are horribly dynamic at the moment, but I really don't have time to rewrite all their door detection code and such.)
Regarding your PlayerInteractEntityEvent error... no idea. That line would be related to trying to place an emerald in an item frame while in a village, but I'm not sure how you'd get a NPE unless... Well, I'm pretty tired at the moment, so for now I'll log it for investigation.
@Poleatar
At the moment you can't. I'll see about adding that in next time I get a chance to code.
I have also been having a problem with mayors changing back to regular villagers.
And when finding a new village uvvillager treats the new village as part of a nearby village - never acknowledging that a new village was found. Each village is more than 100m or 100 blocks away from each other.
Also, sometimes after a mayor exists I get the message that requests that I make a mayor to receive a tribute - even though a mayor exists. As a result one of my villages now has two mayors (and I am not sure how to undo the second mayor).
Aside from these issues - the villages are a popular spot for players to play, get emeralds, and defend the villagers, and fight all kinds of mobs.
I have been getting this error a few times per day:
5:36:52 PM [SEVERE] Could not pass event PlayerInteractEntityEvent to UVVillagers v1.2.5 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.v1_5_R3.PlayerConnection.a(PlayerConnection.java:1088) at net.minecraft.server.v1_5_R3.Packet7UseEntity.handle(SourceFile:36) at net.minecraft.server.v1_5_R3.NetworkManager.b(NetworkManager.java:292) at net.minecraft.server.v1_5_R3.PlayerConnection.d(PlayerConnection.java:115) at net.minecraft.server.v1_5_R3.ServerConnection.b(SourceFile:35) at net.minecraft.server.v1_5_R3.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_5_R3.MinecraftServer.r(MinecraftServer.java:581) at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:226) at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477) at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410) at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573) Caused by: java.lang.NullPointerException at net.uvnode.uvvillagers.UVVillagers.onPlayerInteractEntityEvent(UVVillagers.java:786) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425) ... 14 more
How do you disable this plugin in specific worlds with multiworld?
For some reason, the maximum block size is 32, and it won't detect the underground part of my village D:
Suggested fix- Ability to redefine village dimensions using WorldEdit region
@Xikage
I should have some time this weekend to catch up with issues. I'll take a look at it then.
villageMinPopulation doesn't appear to be working, as villages with as little as 2 villagers are still being recognized. >:|
@jcornwellshiel
I concur with that statement.
Any ideas why one of three villages would state there are no villagers through "/uvv current" (sometimes says 1), but when looking at the server files it has a number like 22?
@der_Kernschatten
I'd prefer to avoid the gimmickiness of teleporting, but if it comes to that... definitely.
@jcornwellshiel
No worries about being busy.
"Maybe the way I'm pathing him back has a distance limit. I'll check on that."
Maybe just have him teleport back if he can't find his way?
Just FYI, I've been really busy with family and work lately, hence the slowdown in development. I've still been able to throw an hour or so toward this every few days, but that's about it.
@der_Kernschatten
Maybe the way I'm pathing him back has a distance limit. I'll check on that.
Regarding the other parts:
I'm in the same boat as you on building/repairing. The only way it could work is possible giving rep for placing doors, and reducing rep for removing doors. (Exactly same amount of rep for each). But... worth it? Probably not.
Tracking player-created golem kills I've not tackled yet, but it's on the docket. Just gotta fig out the best way to do it. ;)
The destroyed item frame thing is a pain. I should really just revise that check so that you can place a new frame if the old one has been broken.
@jcornwellshiel
Ah. Okay.
Regarding losing track, I pushed him across the village close to his home and it seemed like he ran right back to it... almost as if he was found again. Needless to say, I have locked him in the house using a fence.
Some additional thoughts to take or leave:
Building/repairing the village - I wouldn't do this. It's extremely abstract and subjective. There are plenty of other areas to make this fun.
Defending the village - Yes, maybe listen for kills in a radius? Denizen of Citizens might have something that could lead in the right direction. I know some 'questing' scripts have been capable of performing something similar to this.
It would be nice to get tribute in this manner as well. Currently, I find that Golems (and Sentries, but that can be mitigated) take out a good brunt before we can get to the siege mobs.
I haven't found anything exploitable other than the nuisance of the mayor's item frame being destroyed by accident and not being able to replace it due to a mayor existing. This seemed to result in the sign coords switching to -1, -1, -1.
Seems to work just fine with Citizens/Sentry, Rebalance Villagers, and Shopkeepers.
@der_Kernschatten
Chest isn't implemented at the moment. Currently only direct-to-player and mayor tributes work.
As for the mayor, I'm troubleshooting his wanderings at the moment. For some reason the plugin loses track of him occasionally.
jcornwellshiel, great work. This is a fun concept.
I am having trouble with the Mayor. I thought I read somewhere that he was supposed to stay close to his 'home', but I lose him in our large village. It's not too much fun if we are having to hunt him down. While direct pay seems the simplest, I want some form of interaction, so I tried the chest. I failed to make it work... maybe because I already set up the mayor initially? I placed a solid gold block in the ground with a chest on top of it. We stopped receiving notifications of tribute and there was nothing in the chest.
Any thoughts?
Very Fun! only complaint is that the door number randomly fluctuates and is often incorrect. The number of villagers appears not to be affected though. Also, is the ability to change what the tribute is applied yet?
1.2.4 download: http://functionnull.net/UVVillagers-1.2.4.jar
Hoping this fixes the NPE error some people are getting. Let me know.