mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-22 11:55:12 +01:00
Optimization of 'updateAuction() Method' (#80)
Optimization of 'updateAuction() Method'
This commit is contained in:
commit
5523931afd
@ -360,11 +360,13 @@ public class Methods {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Calendar expireTime = Calendar.getInstance();
|
||||
Calendar fullExpireTime = Calendar.getInstance();
|
||||
boolean shouldSave = false;
|
||||
if(data.contains("OutOfTime/Cancelled")) {
|
||||
for(String i : data.getConfigurationSection("OutOfTime/Cancelled").getKeys(false)) {
|
||||
fullExpireTime.setTimeInMillis(data.getLong("OutOfTime/Cancelled." + i + ".Full-Time"));
|
||||
if(cal.after(fullExpireTime)) {
|
||||
data.set("OutOfTime/Cancelled." + i, null);
|
||||
shouldSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,10 +415,11 @@ public class Methods {
|
||||
data.set("OutOfTime/Cancelled." + num + ".Item", data.getItemStack("Items." + i + ".Item"));
|
||||
}
|
||||
data.set("Items." + i, null);
|
||||
shouldSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Files.DATA.saveFile();
|
||||
if(shouldSave) Files.DATA.saveFile();
|
||||
}
|
||||
|
||||
public static String getPrice(String ID, Boolean Expired) {
|
||||
|
Loading…
Reference in New Issue
Block a user