Skip to content

Commit 2a4c9ca

Browse files
committed
Update to mc1.21.7
1 parent 1a31408 commit 2a4c9ca

4 files changed

Lines changed: 24 additions & 3 deletions

File tree

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
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

common/src/main/java/dev/terminalmc/chatnotify/config/Config.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff 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> {

common/src/main/java/dev/terminalmc/chatnotify/config/TextStyle.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
template_version=3
1111

1212
# Mod Version
13-
mod_version=2.4.7
13+
mod_version=2.4.8
1414
# 'STABLE', 'BETA' or 'ALPHA'
1515
mod_version_type=STABLE
1616

0 commit comments

Comments
 (0)