Added save on disable
This commit is contained in:
parent
d3963ab5f4
commit
da8e278c15
1 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
@ -7,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import buttondevteam.discordplugin.EventExceptionDiscordSender;
|
import buttondevteam.discordplugin.EventExceptionDiscordSender;
|
||||||
import buttondevteam.lib.EventExceptionHandler;
|
import buttondevteam.lib.EventExceptionHandler;
|
||||||
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
|
||||||
public class MainPlugin extends JavaPlugin {
|
public class MainPlugin extends JavaPlugin {
|
||||||
public static MainPlugin Instance;
|
public static MainPlugin Instance;
|
||||||
|
@ -14,6 +17,7 @@ public class MainPlugin extends JavaPlugin {
|
||||||
private PluginDescriptionFile pdfFile;
|
private PluginDescriptionFile pdfFile;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Logs "Plugin Enabled", registers commands
|
// Logs "Plugin Enabled", registers commands
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
@ -24,4 +28,13 @@ public class MainPlugin extends JavaPlugin {
|
||||||
EventExceptionHandler.registerEvents(new PlayerListener(), this, new EventExceptionDiscordSender());
|
EventExceptionHandler.registerEvents(new PlayerListener(), this, new EventExceptionDiscordSender());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
logger.info("Saving player data...");
|
||||||
|
for (Entry<UUID, TBMCPlayer> entry : TBMCPlayer.getLoadedPlayers().entrySet()) {
|
||||||
|
TBMCPlayer.savePlayer(entry.getValue());
|
||||||
|
}
|
||||||
|
logger.info("Player data saved.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue