Skip to content

Commit 66fa928

Browse files
committed
cleanup
1 parent cc5b6b5 commit 66fa928

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/main/kotlin/org/bundleproject/bundle/Bundle.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Bundle(private val gameDir: File, private val version: Version, modFolderN
7070
*
7171
* @since 0.0.1
7272
*/
73-
private suspend fun getOutdatedMods(): MutableList<Pair<Mod, RemoteMod>> {
73+
private suspend fun getOutdatedMods(): MutableList<ModPair> {
7474
val localMods = mutableListOf<Mod>()
7575
for (mod in modsDir.walkTopDown()) {
7676
if (mod.isDirectory) continue
@@ -84,13 +84,13 @@ class Bundle(private val gameDir: File, private val version: Version, modFolderN
8484
val request = BulkModRequest(localMods.map { it.makeRequest() })
8585
val response = request.request()
8686

87-
val outdated = mutableListOf<Pair<Mod, RemoteMod>>()
87+
val outdated = mutableListOf<ModPair>()
8888
for (i in localMods.indices) {
8989
val local = localMods[i]
9090
val remote = local.applyData(response[i])
9191

9292
if (remote > local)
93-
outdated.add(local to remote)
93+
outdated.add(ModPair(local, remote))
9494
}
9595

9696
return outdated
@@ -159,7 +159,7 @@ class Bundle(private val gameDir: File, private val version: Version, modFolderN
159159
*
160160
* @since 0.0.2
161161
*/
162-
fun updateMods(mods: List<Pair<Mod, RemoteMod>>) {
162+
fun updateMods(mods: List<ModPair>) {
163163
launchCoroutine("Mod Updater") {
164164
val loading = LoadingGui(mods.size)
165165
loading.isVisible = true

src/main/kotlin/org/bundleproject/bundle/entities/RemoteMod.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ class RemoteMod(
1212
fileName: String,
1313
platform: Platform,
1414
val downloadUrl: String,
15-
) : Mod(enabled, name, id, version, minecraftVersion, fileName, platform) {
16-
}
15+
) : Mod(enabled, name, id, version, minecraftVersion, fileName, platform)

src/main/kotlin/org/bundleproject/bundle/gui/UpdateOverviewGui.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.bundleproject.bundle.gui
33
import org.bundleproject.bundle.Bundle
44
import org.bundleproject.bundle.entities.Mod
55
import org.bundleproject.bundle.entities.RemoteMod
6+
import org.bundleproject.bundle.utils.ModPair
67
import org.bundleproject.bundle.utils.getResourceImage
78
import java.awt.GridBagConstraints
89
import java.awt.GridBagLayout
@@ -17,7 +18,7 @@ import javax.swing.*
1718
*
1819
* @since 0.0.2
1920
*/
20-
class UpdateOverviewGui(private val bundle: Bundle, mods: MutableList<Pair<Mod, RemoteMod>>, condition: Condition? = null) : JFrame("Bundle") {
21+
class UpdateOverviewGui(private val bundle: Bundle, mods: MutableList<ModPair>, condition: Condition? = null) : JFrame("Bundle") {
2122

2223
init {
2324
iconImage = getResourceImage("/bundle.png")
@@ -60,7 +61,7 @@ class UpdateOverviewGui(private val bundle: Bundle, mods: MutableList<Pair<Mod,
6061

6162
val downloadButton = JButton("Update")
6263
downloadButton.addActionListener {
63-
bundle.updateMods(mods.filter { it.second.enabled })
64+
bundle.updateMods(mods.filter { it.remote.enabled })
6465
dispose()
6566
condition?.signal()
6667
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.bundleproject.bundle.utils
2+
3+
import org.bundleproject.bundle.entities.Mod
4+
import org.bundleproject.bundle.entities.RemoteMod
5+
6+
data class ModPair(val local: Mod, val remote: RemoteMod)

0 commit comments

Comments
 (0)