Skip to content

Commit

Permalink
fix: add try catch to debug resource pack
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchen5209 committed Jan 2, 2024
1 parent 2ebf1cb commit 72cb935
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/kotlin/one/oktw/galaxy/proxy/config/ConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ class ConfigManager(private val basePath: Path = Paths.get("config")) {
val packInfo = galaxies[galaxyName]?.let { spec ->
main.logger.info("ResourcePack: ${spec.ResourcePack}")
if (spec.ResourcePack.isNotBlank()) {
return@let ResourcePackInfo.resourcePackInfo()
.id(UUID.nameUUIDFromBytes(spec.ResourcePack.toByteArray(StandardCharsets.UTF_8))) // From Minecraft
.uri(URI(spec.ResourcePack))
.computeHashAndBuild()
.get()
try {
return@let ResourcePackInfo.resourcePackInfo()
.id(UUID.nameUUIDFromBytes(spec.ResourcePack.toByteArray(StandardCharsets.UTF_8))) // From Minecraft
.uri(URI(spec.ResourcePack))
.computeHashAndBuild()
.join()
} catch (e: Exception) {
main.logger.error("Error computing hash and building ResourcePackInfo", e)
return@let null
}
}
return@let null
}
Expand Down

0 comments on commit 72cb935

Please sign in to comment.