diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java index a0dddfb..a6d93a7 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java @@ -182,6 +182,11 @@ public void onPlayerLoginEvent(final @NotNull PlayerJoinEvent event) return player; } + public @Nullable MinepacksPlayerExtended getPlayerCached(final @NotNull OfflinePlayer offlinePlayer) + { + return cache.getCachedPlayer(offlinePlayer.getUniqueId()); + } + // DB Functions public void saveBackpack(final @NotNull Backpack backpack) { diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index c975c79..d22a1d2 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -331,7 +331,9 @@ public void getMinepacksPlayer(final @NotNull OfflinePlayer player, final @NotNu @Override public @Nullable MinepacksPlayerExtended getMinepacksPlayerLoadedOnly(@NotNull OfflinePlayer player) - {//TODO + { + MinepacksPlayerExtended mpPlayer = database.getPlayerCached(player); + if(mpPlayer != null && mpPlayer.isLoaded()) return mpPlayer; return null; }