i just update to version 2.2dev22f, and "on click on a villager" won't work.
Please fix it.
Just tested on 2.2dev22g, can confirm.
I was curious if this was just a result of the trading window interfering, so I tried using spawn a nitwit to spawn the nitwits (which don't have trades) to test on them, and I've also found that Skript-spawned nitwits actually spawn with trades. They seem to have the trades of a random profession/career combo (I've seen ones with blacksmith trades, priest trades, etc.). This is possibly a result of them being spawned, THEN having their profession set, so the trades are set before they are changed to a nitwit.
Not sure why the right click event isn't firing. A fix for the latter issue is to use the setRecipes function of the Merchant API and set it to an empty list for Nitwits in the VillagerData.java's spawn function. This may also just be an issue with their career not being set properly; nitwit is both a profession AND a career, like how "farmer" is a villager profession, but then farmers can specifically be farmers, shepherds, or fishermen.
Updated title of issue report to reflect both of these issues.
Upon further testing when going through old similar issues about right click villager events, I've also found that villagers are even further bugged in the current build (2.2-dev22g). Using send "%target%" on a villager returns entites.normal.name.
Ironically, this means a roundabout, not recommended, busted method for checking and cancelling villager right click events is:
on right click on entity:
"%event-entity%" is "entities.normal.name"
cancel event
wait 1 tick
close inventory of player
This will close the trading interface after a delay, but of course the root issue is what should be fixed.
In Spigot 1.11 or 1.11.2 Spigot changed all Villager classes and updated them. All old villager methods shouldn't work.
The only recent large changes I see to the Villager class is adding the Merchant API, which shouldn't cause the issues occurring here. I don't see any large changes made as a result of 1.11 (which makes sense, as 1.11 didn't add anything that should drastically affect villagers).
Okay, trades of nitwit are now set to an empty list. I hope it works.
I can confirm the nitwit fix did work, however the entities.normal.name issue still persists.
A simple fix for this is add the following to the entities entry on the english.lang file:
normal:
name: villager娄s
pattern: <age> villager(|1娄s)|(4娄)[villager] (kid(|1娄s)|child(|1娄ren))
I've tested and it's working fine for me.
Just getting this issue now on the latest version altho it actually is in the english.lang file. Ill use the workaround mentioned above but idk, this should be fixed i guess? Took me a while to dig this up
Right click events for villagers work. So does broadcast "%entity%" in such event (it broadcasts villager.
@bensku just to clarify, @Tuke-Nuke who fixed this problem just adding it to the language file in his PR as I stated above.
Yeah, I figured that out while writing release notes and gave credit correctly. Sorry that I forgot to do so here.
Most helpful comment
A simple fix for this is add the following to the
entitiesentry on the english.lang file:I've tested and it's working fine for me.