DenizenScript / Depenizen

Addon to Denizen that provides script support for other major plugins.
MIT License
60 stars 45 forks source link

PlayerTag.towny.plots #349

Closed BBCSS closed 3 years ago

BBCSS commented 3 years ago

Would it be possible to get a PlayerTag.towny.plots tag that returns the ChunkTags for each plot a player owns?

The New Issue button in this repo was hiding behind a prompt, sorry.

mcmonkey4eva commented 3 years ago

Might be covered by the new towntag.plot_names tag? Not sure how towny works or how its API corresponds to any of the things people say about it... the API doesn't have "plots" it has "plot groups", which don't have chunk links or anything, seem to just have names and prices.

BBCSS commented 3 years ago

I'll check it out but I'm having issues with the latest release build. Either way, I'll look through the API sometime and see if I can't find some relevant info. I know plot groups are a thing that allow players to group their plots together (to give them all the same player permissions, for example) so I'm not sure much actual location data would be there.

BBCSS commented 3 years ago

I believe in the code, Towny refers to plots as TownBlocks and I do see TownBlock & TownBlockOwner which are also referred to in Resident but I don't know enough about Java to be certain of how they're working together.

mcmonkey4eva commented 3 years ago

TownBlocks appear to be identified by... a vertical Location? an x,z,world, but it's a location not a chunk, so... I've added towntag.plots as a list of locations with the y set to 0. Is that reasonably sufficient? idk if it's just chunks being mishandled, or if it's the location at the center of a chunk, or what... but it definitely gets the X/Z values from a Bukkit Location instance not Chunk, so...

mcmonkey4eva commented 3 years ago

Okay Maxime on discord tested and confirmed that it is actually chunk coords, and the code I was looking at in Towny's source was legitimately just completely misusing Bukkit Location objects, so now it's set correctly and working.