Minenash / CustomHUD

A highly customizable variable-based text HUD for Minecraft
MIT License
82 stars 23 forks source link

The 'TextShadow' global flag in the wiki documentation is either incorrect or broken. #45

Closed Jordanyay closed 2 years ago

Jordanyay commented 2 years ago

Greetings! I have potentially discovered a bug while trying out this mod for the first time in which I would like to make apparent.

https://github.com/Minenash/CustomHUD/wiki/Profile-Structure#global-flags

The example for the 'TextShadow' global flag in the CustomHUD wiki documentation is either incorrect or broken. When following the example configuration for the 'TextShadow' global flag, the in-game hud will display a basic string rather than the formatted text:

image

I have found that this can be fixed by simply adding a single space between the colon and the desired boolean value in the configuration file: ==TextShadow:false== ---> ==TextShadow: false==

This results in the correct formatting of the text:

image

I'm not sure if the wiki documentation is incorrect or if there is an error within the mod itself.

A similar problem also occurred when trying to configure the 'Section Options', more specifically, the 'hide_on_chat' boolean value within the section options. It seems like whatever the problem is, is only affecting the true/false parameters of the configuration file (from what I've tested at least).

I hope this helps, thanks.

JayGuerette commented 2 years ago

The regex for those options in Profile.java are missing handling for optional spaces For example: Current: private static final Pattern TEXT_SHADOW_FLAG_PATTERN = Pattern.compile("== ?TextShadow: (true|false)=="); Should be: private static final Pattern TEXT_SHADOW_FLAG_PATTERN = Pattern.compile("== ?TextShadow: ?(true|false) ?==");

If you remove the spaces before/after the boolean, it should work until it's fixed.

Minenash commented 2 years ago

Can't believe I missed the ? On TextShadow. Not seeing an obvious reason for the hide on chat option, will have to look at it when I get to my pc

JayGuerette commented 2 years ago

Hide on chat is working properly for me. It's likely that it's not obvious the and are NOT optional. @Jordanyay: does your line look like this (the offsets are required)? ==Section:BottomLeft,0,0,true==

Minenash commented 2 years ago

Yeah, to be more specific, any option before the one you want is required

Jordanyay commented 2 years ago

Hide on chat is working properly for me. It's likely that it's not obvious the and are NOT optional. @Jordanyay: does your line look like this (the offsets are required)? ==Section:BottomLeft,0,0,true==

I don't recall ever leaving the offset values blank, maybe I messed up some case-sensitve letters. I've just tested it again and it's working now, thank you.

Jordanyay commented 2 years ago

Hide on chat is working properly for me. It's likely that it's not obvious the and are NOT optional. @Jordanyay: does your line look like this (the offsets are required)? ==Section:BottomLeft,0,0,true==

I don't recall ever leaving the offset values blank, maybe I messed up some case-sensitve letters. I've just tested it again and it's working now, thank you.

Correction: I've just tried adding '-1' for the 'width' section option and it breaks in the same way as my initial problem:

==Section:TopLeft,-2,-2,false,-1== image

If I had to guess, this could be because '-1' is already the default value for the width... It wouldn't make sense to put it in the config manually, therefore never being taken into consideration as a valid option. (https://github.com/Minenash/CustomHUD/wiki/Profile-Structure#section-options)

Minenash commented 2 years ago

Yeah, I guess I never thought about someone actually entering a value that's negative, as since it is the default, it doesn't need to be given.

The text shadow space is fixed in v2.1