diff --git a/build.gradle.kts b/build.gradle.kts index 2294ab8..238bda3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,13 +7,13 @@ val isSnapshot = true group = "dev.reactant" version = "0.2.0${if (isSnapshot) "-SNAPSHOT" else ""}" -val kotlinVersion = "1.3.72" +val kotlinVersion = "1.5.20" plugins { java `maven-publish` signing - kotlin("jvm") version "1.3.72" + kotlin("jvm") version "1.5.20" id("com.github.johnrengelman.shadow") version "5.0.0" id("org.jetbrains.dokka") version "0.10.0" } @@ -37,11 +37,12 @@ repositories { dependencies { compileOnly(kotlin("stdlib-jdk8", kotlinVersion)) - compileOnly("dev.reactant:reactant:0.2.0-SNAPSHOT") - compileOnly("org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT") + compileOnly("dev.reactant:reactant:0.2.3") + compileOnly("org.reflections:reflections:0.9.12") + compileOnly("org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT") - implementation("net.lingala.zip4j:zip4j:2.1.3") - implementation("commons-codec:commons-codec:1.13") + compileOnly("net.lingala.zip4j:zip4j:2.9.1") + compileOnly("commons-codec:commons-codec:1.15") } @@ -63,7 +64,7 @@ val dokkaJar by tasks.registering(Jar::class) { gradle.taskGraph.whenReady { if (allTasks.any { it is Sign }) { allprojects { - extra["signing.keyId"] = findProperty("signingKeyId") as String?; + extra["signing.keyId"] = findProperty("signingKeyId") as String? } } } @@ -75,8 +76,8 @@ val sourcesJar by tasks.registering(Jar::class) { } val shadowJar = (tasks["shadowJar"] as ShadowJar).apply { - relocate("net.lingala.zip4j", "dev.reactant.resourcestirrer.zip4j") - relocate("org.apache.commons.codec", "dev.reactant.resourcestirrer.codec") + // relocate("net.lingala.zip4j", "dev.reactant.resourcestirrer.zip4j") + // relocate("org.apache.commons.codec", "dev.reactant.resourcestirrer.codec") } val javadocJar by tasks.registering(Jar::class) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9492014..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/collector/ItemResourceManagingService.kt b/src/main/kotlin/dev/reactant/resourcestirrer/collector/ItemResourceManagingService.kt index 0910062..03f6246 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/collector/ItemResourceManagingService.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/collector/ItemResourceManagingService.kt @@ -21,16 +21,7 @@ class ItemResourceManagingService( private val _identifierResources = HashMap() public val identifierResources: Map get() = _identifierResources - override fun onEnable() { - containerManager.containers - .flatMap { it.reflections.getTypesAnnotatedWith(ResourcesTable::class.java) } - .asSequence() - .map { it.kotlin } - .filter { it.isSubclassOf(ItemResourcesTable::class) } - .mapNotNull { it.objectInstance as? ItemResourcesTable } - .toList().union(itemResourceProviders.map { it.itemResources }) - .forEach { addItem(it) } - } + override fun onEnable() {} fun addItem(vararg itemResource: ItemResource) { itemResource.forEach { diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/collector/SoundResourceManagingService.kt b/src/main/kotlin/dev/reactant/resourcestirrer/collector/SoundResourceManagingService.kt index 6df4a7b..aba857f 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/collector/SoundResourceManagingService.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/collector/SoundResourceManagingService.kt @@ -23,15 +23,6 @@ class SoundResourceManagingService( val identifierResources get() = ImmutableMap.copyOf(_identifierResources) override fun onEnable() { - containerManager.containers - .flatMap { it.reflections.getTypesAnnotatedWith(ResourcesTable::class.java) } - .asSequence() - .map { it.kotlin } - .filter { it.isSubclassOf(SoundResourcesTable::class) } - .mapNotNull { it.objectInstance as? SoundResourcesTable } - .toList().union(soundResourceProviders.map { it.soundResources }) - .forEach { addSound(it) } - } fun addSound(vararg soundResource: SoundResource) { diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/commands/ResourceStirrerCommandRegister.kt b/src/main/kotlin/dev/reactant/resourcestirrer/commands/ResourceStirrerCommandRegister.kt index 1168cf5..214c03b 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/commands/ResourceStirrerCommandRegister.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/commands/ResourceStirrerCommandRegister.kt @@ -16,16 +16,16 @@ internal class ResourceStirrerCommandRegister( private val commandService: PicocliCommandService, private val itemResourceManagingService: ItemResourceManagingService, private val soundResourceManagingService: SoundResourceManagingService, - private val uiService: ReactantUIService, - private val stirredItemGalleryUI: StirredItemGalleryUI, - private val stirredSoundListUI: StirredSoundListUI, + // private val uiService: ReactantUIService, + // private val stirredItemGalleryUI: StirredItemGalleryUI, + // private val stirredSoundListUI: StirredSoundListUI, private val resourceStirringService: ResourceStirringService ) : LifeCycleHook { override fun onEnable() { register(commandService) { command(::ResourceStirrerCommand) { - command({ StirredItemGalleryCommand(itemResourceManagingService, stirredItemGalleryUI) }) - command({ StirredSoundListCommand(soundResourceManagingService, stirredSoundListUI) }) + //command({ StirredItemGalleryCommand(itemResourceManagingService, stirredItemGalleryUI) }) + //command({ StirredSoundListCommand(soundResourceManagingService, stirredSoundListUI) }) command({ ResourceStirrerPackUpdateCommand(resourceStirringService) }) command({ ResourceStirrerFixToolCommand(resourceStirringService) }) } diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/model/ResourcePackMeta.kt b/src/main/kotlin/dev/reactant/resourcestirrer/model/ResourcePackMeta.kt index 99fce09..d99f966 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/model/ResourcePackMeta.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/model/ResourcePackMeta.kt @@ -7,7 +7,7 @@ class ResourcePackMeta { var pack: PackInfo = PackInfo(); class PackInfo { - var pack_format: Int = 4; + var pack_format: Int = 8; var description: String = "Resource stirrer generated resource pack"; } } diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/stirring/ResourceStirringService.kt b/src/main/kotlin/dev/reactant/resourcestirrer/stirring/ResourceStirringService.kt index ac2f526..4a9dec7 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/stirring/ResourceStirringService.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/stirring/ResourceStirringService.kt @@ -73,7 +73,7 @@ class ResourceStirringService private constructor( val stirringTaskDepth = hashMapOf() fun getStirringTaskDepth(task: ResourceStirringTask): Int { stirringTaskDepth[task] = stirringTaskDepth[task] - ?: (task.dependsOn.map { getStirringTaskDepth(it) }.max() ?: -1) + 1 + ?: (task.dependsOn.map { getStirringTaskDepth(it) }.maxOrNull() ?: -1) + 1 return stirringTaskDepth[task]!! } diff --git a/src/main/kotlin/dev/reactant/resourcestirrer/stirring/tasks/ResourcePackingTask.kt b/src/main/kotlin/dev/reactant/resourcestirrer/stirring/tasks/ResourcePackingTask.kt index 21264cf..24bcadd 100644 --- a/src/main/kotlin/dev/reactant/resourcestirrer/stirring/tasks/ResourcePackingTask.kt +++ b/src/main/kotlin/dev/reactant/resourcestirrer/stirring/tasks/ResourcePackingTask.kt @@ -32,11 +32,14 @@ open class ResourcePackingTask( zip.addFolder(workingDirectory, ZipParameters().also { it.isIncludeRootFolder = false }) ResourceStirrer.logger.info("Generating resource pack sha1...") - val sha1 = DigestUtils.sha1(FileInputStream(zip.file)) + val stream = FileInputStream(zip.file) + val sha1 = DigestUtils.sha1(stream) Hex.encodeHexString(sha1).let { ResourceStirrer.logger.info("Resource pack sha1 is $it") fileWriterService.write(File(ResourceStirrer.resourcePackHashOutputPath), it).blockingAwait() } stirringPlan.resourcePackSha1 = sha1; + stream.close() + zip.close() } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b8536e7..d29c624 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,10 @@ name: ResourceStirrer main: dev.reactant.resourcestirrer.ResourceStirrer version: 0.1.7 -api-version: 1.15 +api-version: 1.18 depend: - Reactant +libraries: + - net.lingala.zip4j:zip4j:2.9.1 + - commons-codec:commons-codec:1.15 + - org.reflections:reflections:0.9.12