Fix watched plugins reloading without ensuring the file has fully uploaded first (#8)

* build: add Apache codec library

Utilise the Apache commons codec library, which has file hashing and checking functions. This will be useful for a fix on hotreloading plugins.

* feat: run tasks later on taskmanagers

Add the ability to run tasks at a later date on task managers.
This is expressed in ticks for bungeecord and bukkit, and is converted to milliseconds for bungeecord.

* feat: add method to get hash of file

Add a method to get the MD5 hash of a file.

* fix: watching plugins waits until the plugin has finished uploading

If a watched plugin is changed, it will no longer immediately reload the plugin. Instead, it will check every 10 ticks (500 milliseconds for BungeeCord) to see if the file MD5 checksum has changed.

If it hasn't, then we can presume the file upload has completed and reload the plugin.

* build: bump version to 2.5.1

* build: relocate apache codec

Relocate the Apache Codec to avoid dependency clashes

* perf: remove unnecessary task call
This commit is contained in:
Phil Gibson 2021-02-03 19:36:31 +00:00 committed by GitHub
parent 5d227ac06e
commit b51ff445dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 19 deletions

View file

@ -5,7 +5,7 @@ plugins {
group = 'net.frankheijden.serverutils'
String dependencyDir = group + '.dependencies'
version = '2.5.0'
version = '2.5.1'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
@ -24,6 +24,7 @@ subprojects {
}
dependencies {
implementation 'commons-codec:commons-codec:1.15'
implementation 'com.github.FrankHeijden:MinecraftReflection:1.0.0'
testCompile 'org.assertj:assertj-core:3.18.1'
@ -65,6 +66,7 @@ dependencies {
}
shadowJar {
relocate 'org.apache.commons.codec', dependencyDir + '.codec'
relocate 'dev.frankheijden.minecraftreflection', dependencyDir + '.minecraftreflection'
archiveFileName = "${archiveBaseName.orNull}-${archiveVersion.orNull}.${archiveExtension.orNull}"
}