mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Replace Bukkit schedulers in SaveTimerTask.java
This commit is contained in:
parent
0603faff33
commit
7f64987585
@ -644,7 +644,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
||||||
|
|
||||||
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
new SaveTimerTask().runTaskTimer(saveIntervalTicks, saveIntervalTicks);
|
||||||
|
|
||||||
// Cleanup the backups folder
|
// Cleanup the backups folder
|
||||||
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
||||||
|
@ -5,12 +5,15 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||||
import com.gmail.nossr50.util.LogUtils;
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import com.tcoded.folialib.wrapper.WrappedTask;
|
||||||
|
|
||||||
public class SaveTimerTask extends BukkitRunnable {
|
import java.util.concurrent.TimeUnit;
|
||||||
@Override
|
|
||||||
public void run() {
|
public class SaveTimerTask {
|
||||||
|
public WrappedTask runTaskTimer(long delay, long period) {
|
||||||
|
return mcMMO.p.getFoliaLib().getImpl().runTimer(() -> {
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
|
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
|
||||||
// All player data will be saved periodically through this
|
// All player data will be saved periodically through this
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@ -22,5 +25,6 @@ public class SaveTimerTask extends BukkitRunnable {
|
|||||||
|
|
||||||
|
|
||||||
PartyManager.saveParties();
|
PartyManager.saveParties();
|
||||||
|
}, delay * Misc.TICK_CONVERSION_FACTOR, period * Misc.TICK_CONVERSION_FACTOR, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user