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:
parent
5d227ac06e
commit
b51ff445dd
6 changed files with 75 additions and 19 deletions
|
|
@ -4,6 +4,7 @@ import net.frankheijden.serverutils.bungee.ServerUtils;
|
|||
import net.frankheijden.serverutils.common.managers.AbstractTaskManager;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.scheduler.ScheduledTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class BungeeTaskManager extends AbstractTaskManager<ScheduledTask> {
|
||||
|
||||
|
|
@ -16,6 +17,12 @@ public class BungeeTaskManager extends AbstractTaskManager<ScheduledTask> {
|
|||
return runTaskAsynchronously(runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledTask runTaskLater(Runnable runnable, long delay) {
|
||||
return ProxyServer.getInstance().getScheduler()
|
||||
.schedule(ServerUtils.getInstance(), runnable, delay * 50, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ScheduledTask runTaskAsynchronouslyImpl(Runnable runnable) {
|
||||
return ProxyServer.getInstance().getScheduler().runAsync(ServerUtils.getInstance(), runnable);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue