mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Lets clear out block protection by set days limit on plugin load
This commit is contained in:
parent
8e7a959f39
commit
0b1c035c4b
@ -12,6 +12,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||
import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.DBAction;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class BlockProtectionManager {
|
||||
|
||||
@ -100,7 +101,7 @@ public class BlockProtectionManager {
|
||||
|
||||
locations.put(v, Bp);
|
||||
|
||||
if (locations.size() > 100) {
|
||||
if (locations.size() > 10) {
|
||||
Jobs.getJobsDAO().saveBlockProtection(loc.getWorld().getName(), new HashMap<String, BlockProtection>(locations));
|
||||
locations.clear();
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
@ -1048,7 +1049,6 @@ public abstract class JobsDAO {
|
||||
close(limitsStatement);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void recordNewJobName(Job job) {
|
||||
@ -2187,10 +2187,22 @@ public abstract class JobsDAO {
|
||||
if (conn == null)
|
||||
return;
|
||||
PreparedStatement prest = null;
|
||||
PreparedStatement prestDel = null;
|
||||
ResultSet res = null;
|
||||
|
||||
Jobs.getBpManager().timer = 0L;
|
||||
|
||||
try {
|
||||
Long mark = System.currentTimeMillis() - (Jobs.getGCManager().BlockProtectionDays * 24L * 60L * 60L * 1000L);
|
||||
prestDel = conn.prepareStatement("DELETE FROM `" + DBTables.BlocksTable.getTableName() + "` WHERE `" + BlockTableFields.recorded.getCollumn() + "` < ?;");
|
||||
prestDel.setLong(1, mark);
|
||||
prestDel.execute();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
close(prestDel);
|
||||
}
|
||||
|
||||
try {
|
||||
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.BlocksTable.getTableName() + "`;");
|
||||
res = prest.executeQuery();
|
||||
|
Loading…
Reference in New Issue
Block a user