Skip to content

Bug fixes & Updates #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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")

}

Expand All @@ -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?
}
}
}
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,7 @@ class ItemResourceManagingService(
private val _identifierResources = HashMap<String, ItemResource>()
public val identifierResources: Map<String, ItemResource> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ResourceStirringService private constructor(
val stirringTaskDepth = hashMapOf<ResourceStirringTask, Int>()
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]!!
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
6 changes: 5 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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