Skip to content

Fix /t jail error when town jail is removed - #8286

Open
MidSpike wants to merge 1 commit into
TownyAdvanced:masterfrom
MidSpike:fix-jails-1
Open

Fix /t jail error when town jail is removed#8286
MidSpike wants to merge 1 commit into
TownyAdvanced:masterfrom
MidSpike:fix-jails-1

Conversation

@MidSpike

Copy link
Copy Markdown

Description:

Issue:

The following error can happen under specific conditions when using /t jail <ign>.

image

Reproduction steps:

  1. Create a new town and claim a 2nd plot.
  2. Go to the 2nd plot and run /plot set jail to make a jail.
  3. Run /plot set default to remove the jail (should be the only one).
  4. Attempt to jail a resident /t jail <ign>.
  5. Observe error message in chat.

Fixed by this PR:

image

My solution centered around replacing the prior nullability pattern for Town.jails to be pre-initialized like other properties. I did a basic look around and touched up related locations that could have been impacted or related.

Unrelated:

While working on this PR, I noticed other areas regarding the jails command system appear to be unused and/or redundant. For example, parameters town and admin are effectively not needed [ 1, 2 ] as admin is hard-coded to false in the only invocation of parseJailCommand(CommandSender sender, Town town, String[] split, boolean admin). I reckon a larger refactor like that exceeds the scope of this bugfix.


New Nodes/Commands/ConfigOptions:

N/A


Relevant Towny Issue ticket:

N/A


Attestations

  • I have tested this pull request for defects on a server.

By making this pull request, I represent that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the TownyAdvanced organization has the copyright to use and modify my contribution under the Towny License for perpetuity.

In making this pull request, I declare that I have not used an AI toolset to design or code this pull request, and that I am a human who coded this without any influence from an LLM.

@LlmDl LlmDl added this to the 0.103.3.0 milestone Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants