From 226a376be9cc960eb8c7697a88ff46dc4c43bfda Mon Sep 17 00:00:00 2001 From: comp500 Date: Thu, 10 Feb 2022 16:32:55 +0000 Subject: [PATCH] Import author/version metadata from CurseForge packs --- curseforge/import.go | 5 +++-- curseforge/packinterop/interfaces.go | 2 ++ curseforge/packinterop/manifest.go | 8 ++++++++ curseforge/packinterop/minecraftinstance.go | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/curseforge/import.go b/curseforge/import.go index 52b1817..a48405d 100644 --- a/curseforge/import.go +++ b/curseforge/import.go @@ -154,8 +154,9 @@ var importCmd = &cobra.Command{ } pack = core.Pack{ - Name: packImport.Name(), - // TODO: author, version? + Name: packImport.Name(), + Author: packImport.PackAuthor(), + Version: packImport.PackVersion(), PackFormat: core.CurrentPackFormat, Index: struct { File string `toml:"file"` diff --git a/curseforge/packinterop/interfaces.go b/curseforge/packinterop/interfaces.go index d2bc905..5ad9ba5 100644 --- a/curseforge/packinterop/interfaces.go +++ b/curseforge/packinterop/interfaces.go @@ -9,6 +9,8 @@ type ImportPackFile interface { type ImportPackMetadata interface { Name() string + PackAuthor() string + PackVersion() string Versions() map[string]string Mods() []AddonFileReference GetFiles() ([]ImportPackFile, error) diff --git a/curseforge/packinterop/manifest.go b/curseforge/packinterop/manifest.go index 5ca05b1..cd0c43c 100644 --- a/curseforge/packinterop/manifest.go +++ b/curseforge/packinterop/manifest.go @@ -31,6 +31,14 @@ func (c cursePackMeta) Name() string { return c.NameInternal } +func (c cursePackMeta) PackVersion() string { + return c.Version +} + +func (c cursePackMeta) PackAuthor() string { + return c.Author +} + func (c cursePackMeta) Versions() map[string]string { vers := make(map[string]string) vers["minecraft"] = c.Minecraft.Version diff --git a/curseforge/packinterop/minecraftinstance.go b/curseforge/packinterop/minecraftinstance.go index f384ee7..6473534 100644 --- a/curseforge/packinterop/minecraftinstance.go +++ b/curseforge/packinterop/minecraftinstance.go @@ -34,6 +34,14 @@ func (m twitchInstalledPackMeta) Name() string { return m.NameInternal } +func (m twitchInstalledPackMeta) PackAuthor() string { + return "" +} + +func (m twitchInstalledPackMeta) PackVersion() string { + return "" +} + func (m twitchInstalledPackMeta) Versions() map[string]string { vers := make(map[string]string) vers["minecraft"] = m.MCVersion