From 79ce8bc215cbf311d367338ea4cd42c3af42470f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 30 Apr 2021 17:37:23 +0200 Subject: [PATCH] Add JavaDoc to ConfigUpdater --- .../bausystem/configplayer/ConfigUpdater.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigUpdater.java b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigUpdater.java index 9724dea5..c411f295 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigUpdater.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigUpdater.java @@ -18,8 +18,6 @@ import java.util.logging.Level; @Linked(LinkageType.LISTENER) public class ConfigUpdater implements Listener { - // TODO: implement everything - private final Map playerConfigurations = new HashMap<>(); private static final Map 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) {