Skip to content

Commit

Permalink
Update to latest utility version
Browse files Browse the repository at this point in the history
  • Loading branch information
EsotericEnderman committed Nov 3, 2024
1 parent ae1c99e commit 61fb366
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {

implementation("commons-io:commons-io:2.17.0")

implementation("com.github.EsotericFoundation:utility.kt:0.4.1")
implementation("com.github.EsotericFoundation:utility.kt:1.0.0")
}

java {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package foundation.esoteric.minecraft.plugins.library.file

import foundation.esoteric.utility.resource.ResourceUtility
import foundation.esoteric.utility.resource.resourceFilePaths
import org.bukkit.plugin.java.JavaPlugin
import java.io.File
import java.nio.file.Path
Expand All @@ -10,7 +10,7 @@ class FileManager(private val plugin: JavaPlugin) {
fun saveResourceFolder(resourcePath: Path, replace: Boolean = false): File {
plugin.dataFolder.mkdir()

ResourceUtility.getResourceFilePaths(resourcePath).forEach {
resourcePath.resourceFilePaths().forEach {
path -> plugin.saveResource(path.toString(), replace)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package foundation.esoteric.minecraft.plugins.library.pack.resource

import foundation.esoteric.utility.file.FileUtility
import foundation.esoteric.utility.file.sha1
import net.kyori.adventure.resource.ResourcePackInfo
import net.kyori.adventure.resource.ResourcePackRequest
import org.bukkit.event.EventHandler
Expand All @@ -15,7 +15,7 @@ import java.net.URI
*/
class ResourcePackListener(plugin: ResourcePackPlugin, resourcePackServer: ResourcePackServer) : Listener {
private val resourcePackInfo = ResourcePackInfo.resourcePackInfo()
.hash(FileUtility.Companion.getSha1Hash(plugin.resourcePackManager.resourcePackZipFile!!))
.hash(plugin.resourcePackManager.resourcePackZipFile!!.sha1())
.uri(URI.create("http://" + resourcePackServer.socketAddress + "/")).build()

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package foundation.esoteric.minecraft.plugins.library.pack.resource

import foundation.esoteric.minecraft.plugins.library.file.FileManagedPlugin
import foundation.esoteric.utility.file.FileUtility
import foundation.esoteric.utility.file.zip
import org.apache.commons.io.FileUtils
import java.io.File

Expand All @@ -27,7 +27,7 @@ class ResourcePackManager(private val plugin: FileManagedPlugin) {

try {
resourcePackZipFile = File(resourceZipFilePath)
FileUtility.zipFolder(resourcePackFolder, resourcePackZipFile!!)
resourcePackFolder.zip(resourcePackZipFile!!)

FileUtils.deleteDirectory(resourcePackFolder)
} catch (exception: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package foundation.esoteric.minecraft.plugins.library.file

import be.seeseemelk.mockbukkit.MockBukkit
import foundation.esoteric.minecraft.plugins.library.TestPlugin
import foundation.esoteric.utility.file.FileUtility
import foundation.esoteric.utility.file.sha1
import java.io.File
import kotlin.test.*

Expand Down Expand Up @@ -77,7 +77,7 @@ class FileManagerTest {
assertTrue(resourcePack.isFile)
assertFalse(resourcePack.isDirectory)

val hash = FileUtility.getSha1Hash(resourcePack)
val hash = resourcePack.sha1()
assertEquals("c276751b2c56bc44bce393fb3356c0bd9f3a91b4", hash)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package foundation.esoteric.minecraft.plugins.library.pack.resource

import be.seeseemelk.mockbukkit.MockBukkit
import foundation.esoteric.minecraft.plugins.library.TestPlugin
import foundation.esoteric.utility.file.FileUtility
import java.io.File
import kotlin.test.*

Expand Down

0 comments on commit 61fb366

Please sign in to comment.