Refactor some database related methods

This commit is contained in:
GeorgH93 2021-05-24 00:00:09 +02:00
parent 07f8940904
commit 3d887db3cb
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 8 additions and 14 deletions

View File

@ -146,18 +146,15 @@ public void backup(@NotNull Backpack backpack)
private void loadPlayer(final @NotNull MinepacksPlayerData player)
{
if(syncCooldown)
player.setCooldownData(System.currentTimeMillis());
backend.loadPlayer(player);
player.notifyOnLoad(p -> {
if(!bungeeCordMode)
{
player.notifyOnLoad(p -> {
loadBackpack(player);
}
});
}
}
public void loadBackpack(final @NotNull MinepacksPlayerData player)
{
@ -175,7 +172,7 @@ public void onPlayerLoginEvent(final @NotNull PlayerJoinEvent event)
});
}
public @NotNull MinepacksPlayerExtended getPlayer(final @NotNull OfflinePlayer offlinePlayer)
public @NotNull MinepacksPlayerData getPlayer(final @NotNull OfflinePlayer offlinePlayer)
{
MinepacksPlayerData player = cache.getCachedPlayer(offlinePlayer.getUniqueId());
if(player != null) return player;

View File

@ -29,10 +29,7 @@
import at.pcgamingfreaks.Minepacks.Bukkit.Command.CommandManager;
import at.pcgamingfreaks.Minepacks.Bukkit.Command.InventoryClearCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.Command.ShortcutCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.BackpacksConfig;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Config;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Language;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.*;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.BackpackExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
@ -310,7 +307,7 @@ public void getBackpack(final @NotNull OfflinePlayer owner, final @NotNull Callb
}
@Override
public @NotNull MinepacksPlayerExtended getMinepacksPlayer(final @NotNull OfflinePlayer player)
public @NotNull MinepacksPlayerData getMinepacksPlayer(final @NotNull OfflinePlayer player)
{
return database.getPlayer(player);
}