feat(commands): introduce /mc query command with initial 'idlebuilders' query #11036
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
This PR introduces a new
/mc query
command subtree designed to support queries for players and admins.Please note - this is my first PR ever. Add all the caveats that might go along with that. I have no real JAVA experience (but have considerable experience in other languages) and I wanted to set a goal to learn how to develop a mod and I thought contributing something I thought would be useful in one of my favorite modpacks would be a good place to start.
I did my best to match your structure and style so that there isn't any pain for you there, but definitely welcome to any feedback you might have on my approach. Thanks.
New command:
/mc query idlebuilders
Reports a list of builder citizens who currently have no active work orders and are therefore idle. Each entry includes a clickable teleport link to the citizen’s builder hut. Justification: I always do a lot of unassigned build commands, but many times a building will only be close enough for a single builder to ever get assigned this build automatically. As a result you might end up with a builder or 2 just hiding in their huts because there is nothing to assign to them (even though there are lots of things set to build).
Design Notes:
Adds a new class:
CommandQueryIdleBuilders
Uses
getClosestColony(...)
andisCoordinateInAnyColony(...)
to determine the relevant colony context based on the player’s current position.Duplicates the
styleWithTeleport()
method (originally inCommandCitizenInfo.java
) for generating clickable/tp
links. I thought about just creating a public version, but that seemed beyond scope of this PR, but this could be made a shared utility in a future refactor.Future extensions could include: (but I didn't want to go here without your interest).
I am sure others may have more creative ideas than me, but a couple that I quickly though might be useful:
/mc query vacancies
: Report houses which have an open bed/mc query workdistance <blockdistance>
: Identify citizens whose home/work distance exceeds a threshold.Testing
Review please
Appreciate any comments or feedback you might be able to provide.