mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-07 19:28:11 +01:00
Fix error with cooldown sync
This commit is contained in:
parent
b688cd3022
commit
9d851304f2
@ -96,10 +96,7 @@ public void onPlayerJoinEvent(PlayerJoinEvent event)
|
||||
@Override
|
||||
public void onResult(Long dbCooldownTime)
|
||||
{
|
||||
if(dbCooldownTime > System.currentTimeMillis())
|
||||
{
|
||||
cooldowns.put(uuid, dbCooldownTime);
|
||||
}
|
||||
cooldowns.put(uuid, dbCooldownTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ protected void checkDB()
|
||||
"REFERENCES {TablePlayers} ({FieldPlayerID}) ON DELETE CASCADE ON UPDATE CASCADE\n);"));
|
||||
if(syncCooldown)
|
||||
{
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TableCooldowns} (\n{FieldCDPlayer} INT UNSIGNED NOT NULL,\n{FieldCDTime} LONG NOT NULL,\nPRIMARY KEY ({FieldCDPlayer}),\n" +
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TableCooldowns} (\n{FieldCDPlayer} INT UNSIGNED NOT NULL,\n{FieldCDTime} DATETIME NOT NULL,\nPRIMARY KEY ({FieldCDPlayer}),\n" +
|
||||
"CONSTRAINT fk_{TableCooldowns}_{TablePlayers}_{FieldCDPlayer} FOREIGN KEY ({FieldCDPlayer}) " +
|
||||
"REFERENCES {TablePlayers} ({FieldPlayerID}) ON DELETE CASCADE ON UPDATE CASCADE\n);"));
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ public void getCooldown(final Player player, final Callback<Long> callback)
|
||||
ps.setString(1, getPlayerFormattedUUID(player));
|
||||
try(ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
final long time = (rs.next()) ? rs.getLong(fieldCdTime) : 0;
|
||||
final long time = (rs.next()) ? rs.getTimestamp(fieldCdTime).getTime() : 0;
|
||||
plugin.getServer().getScheduler().runTask(plugin, () -> callback.onResult(time));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user