Skip to content

Calls to ICommand interface methods are now wrapped in try, and catch the common CommandException exception.#3

Merged
Dream-Master merged 2 commits into
GTNewHorizons:masterfrom
Viptunbeqwfwew:fix-for-command-exeption
May 29, 2026
Merged

Calls to ICommand interface methods are now wrapped in try, and catch the common CommandException exception.#3
Dream-Master merged 2 commits into
GTNewHorizons:masterfrom
Viptunbeqwfwew:fix-for-command-exeption

Conversation

@Viptunbeqwfwew
Copy link
Copy Markdown

@Viptunbeqwfwew Viptunbeqwfwew commented Feb 26, 2026

To run the /help command in the server console.

Fix GTNewHorizons/GT-New-Horizons-Modpack#13490
Fix GTNewHorizons/GT-New-Horizons-Modpack#3175

… the common CommandException exception. (Formatting)
Copy link
Copy Markdown

@Algent Algent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't seen it happen in /help on daily when I was testing stuff the other day but this does seem a useful change.

Also copying the picture from your fix from the issue since it's relevant here too:
image

@Viptunbeqwfwew
Copy link
Copy Markdown
Author

As far as I remember, the error appears only in the console, at https://github.com/GTNewHorizons/IguanaTweaksTConstruct/blob/f92ecf760d1d419f4bdb69158391e8d2680ff9fb/src/main/java/iguanaman/iguanatweakstconstruct/commands/CommandIAmADirtyCheater.java#L23

Specifically, due to the exception thrown by the getCommandSenderAsPlayer method. https://github.com/GTNewHorizons/IguanaTweaksTConstruct/blob/f92ecf760d1d419f4bdb69158391e8d2680ff9fb/src/main/java/iguanaman/iguanatweakstconstruct/commands/CommandIAmADirtyCheater.java#L62

It turned out that it was impossible to find a player for the console, but the player search was used in a method that returned a hint. This led to the command loop being interrupted, which in turn resulted in the hint not being displayed in the server console.

And since it's difficult to ensure conflict-free coding across multiple mods, it's better to add an additional layer of exception handling.

Actually, I just saw the issues when I was in a good mood. I figured it out and fixed it. =)

@Dream-Master Dream-Master merged commit 7f74fdf into GTNewHorizons:master May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server side help command. Help command broken on servers

3 participants