SteamWar/BauSystem2.0
Archiviert
12
0

Add JavaDoc to ConfigUpdater

Dieser Commit ist enthalten in:
yoyosource 2021-04-30 17:37:23 +02:00
Ursprung 43bb175d19
Commit 79ce8bc215

Datei anzeigen

@ -18,8 +18,6 @@ import java.util.logging.Level;
@Linked(LinkageType.LISTENER)
public class ConfigUpdater implements Listener {
// TODO: implement everything
private final Map<UUID, YAPIONObject> playerConfigurations = new HashMap<>();
private static final Map<Integer, ConfigConverter> CONFIG_CONVERTER_MAP = new HashMap<>();
@ -30,23 +28,35 @@ public class ConfigUpdater implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
// Load call -> Database
get(event.getPlayer());
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
// Save call -> Database
save(event.getPlayer());
playerConfigurations.remove(event.getPlayer().getUniqueId());
}
public YAPIONObject load(Player player) {
/**
* Get a PlayerConfig, optionally loads it from the DataBase and migrates it if necessary.
*
* @param player the player from whom to get the config.
* @return the config object
*/
public YAPIONObject get(Player player) {
if (!playerConfigurations.containsKey(player.getUniqueId())) {
// Load call -> Database
// TODO: Load call -> Database
}
return playerConfigurations.get(player.getUniqueId());
}
/**
* Save a PlayerConfig, this does not remove the key value mapping from the map.
*
* @param player the player to save the config.
*/
public void save(Player player) {
// Save call -> Database
// TODO: Save call -> Database
}
private YAPIONObject update(YAPIONObject yapionObject) {