Added support for the new SongodaCore data loading system.

This commit is contained in:
Brianna 2020-09-24 14:39:38 -05:00
parent 392c88d560
commit 6ba34246f2

View File

@ -124,18 +124,12 @@ public class EpicHeads extends SongodaPlugin {
// Load Heads
loadHeads();
// Load Favorites
loadData();
int timeout = Settings.AUTOSAVE.getInt() * 60 * 20;
Bukkit.getScheduler().runTaskTimerAsynchronously(this, this::saveToFile, timeout, timeout);
}
private void saveToFile() {
storage.doSave();
}
private void loadData() {
@Override
public void onDataLoad() {
// Adding in favorites.
if (storage.containsGroup("players")) {
for (StorageRow row : storage.getRowsByGroup("players")) {
@ -154,6 +148,9 @@ public class EpicHeads extends SongodaPlugin {
this.saveToFile();
}
private void saveToFile() {
storage.doSave();
}
private void downloadHeads() {
try {