File tree Expand file tree Collapse file tree
common/src/main/java/dev/terminalmc/chatnotify/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 2.4.8
4+
5+ - Fixed color deserialization (1.21.6-7 only)
6+
37## 2.4.7
48
59- Fixed an issue with replacement message styling duplicating components
Original file line number Diff line number Diff line change @@ -431,8 +431,11 @@ public static void save() {
431431 */
432432 private Config validate () {
433433 // Validate defaults
434- if (defaultColor < 0 || defaultColor > 0xFFFFFFFF )
434+ if (defaultColor < - 0xFFFFFF || defaultColor > 0xFFFFFF ) {
435435 defaultColor = defaultColorDefault ;
436+ } else {
437+ defaultColor = rgbToArgb (defaultColor );
438+ }
436439 defaultSound .validate ();
437440
438441 // Remove blank prefixes and sort by decreasing length
@@ -465,6 +468,17 @@ private void validateUserNotif() {
465468 }
466469 }
467470
471+ /**
472+ * Converts an RGB color to an ARGB color, if necessary.
473+ */
474+ static int rgbToArgb (int rgb ) {
475+ if (rgb >= 0x000000 && rgb <= 0xFFFFFF ) {
476+ return rgb | 0xFF000000 ;
477+ } else {
478+ return rgb ;
479+ }
480+ }
481+
468482 // Deserialization
469483
470484 public static class Deserializer implements JsonDeserializer <Config > {
Original file line number Diff line number Diff line change @@ -133,8 +133,11 @@ public Style getStyle() {
133133 * Validates this instance. Called after deserialization and before saving.
134134 */
135135 TextStyle validate () {
136- if (color < 0 || color > 0xFFFFFFFF )
136+ if (color < - 0xFFFFFF || color > 0xFFFFFF ) {
137137 color = colorDefault ;
138+ } else {
139+ color = Config .rgbToArgb (color );
140+ }
138141 return this ;
139142 }
140143
Original file line number Diff line number Diff line change 1010template_version =3
1111
1212# Mod Version
13- mod_version =2.4.7
13+ mod_version =2.4.8
1414# 'STABLE', 'BETA' or 'ALPHA'
1515mod_version_type =STABLE
1616
You can’t perform that action at this time.
0 commit comments