mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-21 17:59:35 +01:00
23 lines
769 B
Java
23 lines
769 B
Java
package com.gmail.nossr50.runnables.database;
|
|
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.database.SQLDatabaseManager;
|
|
import com.gmail.nossr50.util.player.UserManager;
|
|
|
|
public class SQLReconnectTask extends BukkitRunnable {
|
|
@Override
|
|
public void run() {
|
|
if (((SQLDatabaseManager) mcMMO.getDatabaseManager()).checkConnected()) {
|
|
UserManager.saveAll(); // Save all profiles
|
|
UserManager.clearAll(); // Clear the profiles
|
|
|
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
UserManager.addUser(player); // Add in new profiles, forcing them to 'load' again from MySQL
|
|
}
|
|
}
|
|
}
|
|
}
|