Fix some database issues

This commit is contained in:
GeorgH93 2021-05-23 23:56:03 +02:00
parent 22231d2652
commit 07f8940904
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,7 @@
import at.pcgamingfreaks.Database.ConnectionProvider.ConnectionProvider;
import at.pcgamingfreaks.Database.ConnectionProvider.MySQLConnectionProvider;
import at.pcgamingfreaks.Database.DBTools;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.MinepacksPlayerData;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import org.intellij.lang.annotations.Language;
@ -72,4 +73,11 @@ protected void checkDB()
e.printStackTrace();
}
}
@Override
protected void updatePlayer(final @NotNull Connection connection, final @NotNull MinepacksPlayerData player) throws SQLException
{
DBTools.runStatement(connection, queryInsertPlayer, player.getName(), formatUUID(player.getUUID()), formatUUID(player.getUUID()));
DBTools.runStatement(connection, queryUpdatePlayer, player.getName(), formatUUID(player.getUUID()));
}
}

View File

@ -269,7 +269,7 @@ public void loadPlayer(final @NotNull MinepacksPlayerData player)
{
final int id = rs.getInt(fieldPlayerID);
long cooldown = 0;
if(syncCooldown) cooldown = rs.getTimestamp(fieldCdPlayerID).getTime();
if(syncCooldown && rs.getTimestamp(fieldCdTime) != null) cooldown = rs.getTimestamp(fieldCdTime).getTime();
final long cd = cooldown;
plugin.getServer().getScheduler().runTask(plugin, () -> player.setLoaded(id, cd));
return;