mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-08 20:01:25 +01:00
Only use one date format instance
This commit is contained in:
parent
a2756620f5
commit
bc284a0717
@ -38,7 +38,8 @@ import com.zaxxer.hikari.HikariDataSource;
|
|||||||
public abstract class Database {
|
public abstract class Database {
|
||||||
private static final int DATABASE_VERSION = 2;
|
private static final int DATABASE_VERSION = 2;
|
||||||
|
|
||||||
private static Set<String> notFoundWorlds = new HashSet<>();
|
private final Set<String> notFoundWorlds = new HashSet<>();
|
||||||
|
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
String tableShops;
|
String tableShops;
|
||||||
String tableLogs;
|
String tableLogs;
|
||||||
@ -147,7 +148,7 @@ public abstract class Database {
|
|||||||
long time = 0L;
|
long time = 0L;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(timestamp).getTime();
|
time = dateFormat.parse(timestamp).getTime();
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
plugin.debug("Failed to parse timestamp '" + timestamp + "': Time is set to 0");
|
plugin.debug("Failed to parse timestamp '" + timestamp + "': Time is set to 0");
|
||||||
plugin.debug(e);
|
plugin.debug(e);
|
||||||
@ -487,7 +488,7 @@ public abstract class Database {
|
|||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
|
|
||||||
ps.setInt(1, shop.getID());
|
ps.setInt(1, shop.getID());
|
||||||
ps.setString(2, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(millis));
|
ps.setString(2, dateFormat.format(millis));
|
||||||
ps.setLong(3, millis);
|
ps.setLong(3, millis);
|
||||||
ps.setString(4, executor.getName());
|
ps.setString(4, executor.getName());
|
||||||
ps.setString(5, executor.getUniqueId().toString());
|
ps.setString(5, executor.getUniqueId().toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user