[BUG] Handle Adventure serializer errors with a fallback value

This commit is contained in:
2025-04-28 13:57:21 +02:00
parent fbcf545119
commit c6e5549fa9
3 changed files with 10 additions and 15 deletions

View File

@@ -36,8 +36,12 @@ public class ChatUtils {
}
public static net.kyori.adventure.text.Component mojangToAdventure(Component inComponent) {
final String serialised = Component.Serializer.toJson(inComponent, getRegistryLookup());
return adventureSerializer.deserialize(serialised);
try {
final String serialised = Component.Serializer.toJson(inComponent, getRegistryLookup());
return adventureSerializer.deserialize(serialised);
} catch (Exception e) {
return net.kyori.adventure.text.Component.text(inComponent.getString());
}
}
private static HolderLookup.Provider getRegistryLookup() {

View File

@@ -1,13 +1,4 @@
**Bug Fixes**:
- Fixed LuckPerms breaking commands on Paper
- Fix Config watcher using too many threads and not detecting changes on Linux systems
**New Features**:
- Added Nojang API to allow mods to access GameRules (SDLink)
- Exposed Adventure JSON serializer to mods
**Dev Changes**:
- Bumped MoonConfig - `1.0.10` -> `1.0.12`
- Fix Adventure Serializer failing completely when serialization fails, causing game glitches
-

View File

@@ -1,8 +1,8 @@
#Project
version_major=2
version_minor=1
version_patch=4
version_build=2
version_patch=5
version_build=0
#Mod
mod_author=HypherionSA