diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 899d1cdb..2471d928 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -305,7 +305,7 @@ public class MMOCore extends JavaPlugin { * the player datas can't recognize what profess the player has and * professes will be lost */ - Bukkit.getOnlinePlayers().forEach(player -> PlayerData.setup(player).setPlayer(player)); + Bukkit.getOnlinePlayers().forEach(player -> PlayerData.setup(player)); // commands try { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index f2465958..7951324c 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -232,7 +232,7 @@ public class PlayerData { public static PlayerData setup(Player player) { if (!playerData.containsKey(player.getUniqueId())) playerData.put(player.getUniqueId(), new PlayerData(player).load(new ConfigFile(player).getConfig())); - return get(player); + return get(player).setPlayer(player); } public static boolean isLoaded(UUID uuid) { @@ -281,7 +281,7 @@ public class PlayerData { * END OF EXPERIMENTAL CODE */ - public PlayerData setPlayer(Player player) { + private PlayerData setPlayer(Player player) { this.player = player; this.lastLogin = System.currentTimeMillis(); return this; diff --git a/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java b/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java index 186d7daf..93013924 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java @@ -32,7 +32,7 @@ public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void a(PlayerJoinEvent event) { Player player = event.getPlayer(); - PlayerData pd = PlayerData.setup(player).setPlayer(player); pd.getStats().updateAll(); + PlayerData.setup(player).getStats().updateAll(); } /*