Fixed version error

This commit is contained in:
Butzlabben 2019-11-24 16:28:45 +01:00
parent d0579b5f7e
commit 7b225b36e9
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package de.butzlabben.world.util;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
/**
* @author Butzlabben
@ -49,4 +50,10 @@ public class VersionUtil {
}
return version;
}
public static boolean isCancelled(BukkitTask task) {
if(getVersion() <= 12)
return false;
return task.isCancelled();
}
}

View File

@ -7,6 +7,7 @@ import de.butzlabben.world.event.WorldCreateEvent;
import de.butzlabben.world.event.WorldLoadEvent;
import de.butzlabben.world.event.WorldUnloadEvent;
import de.butzlabben.world.util.PlayerPositions;
import de.butzlabben.world.util.VersionUtil;
import org.apache.commons.io.FileUtils;
import org.bukkit.*;
import org.bukkit.entity.Player;
@ -444,7 +445,7 @@ public class SystemWorld {
this.unloading = unloading;
// Cancel unload task if unloading is set to false
if (!unloading && unloadLaterTask != null && !unloadLaterTask.isCancelled()) {
if (!unloading && unloadLaterTask != null && !VersionUtil.isCancelled(unloadLaterTask)) {
unloadLaterTask.cancel();
}
}