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.CMILib.ItemManager.CMIMaterial;
|
||||||
import com.gamingmesh.jobs.container.BlockProtection;
|
import com.gamingmesh.jobs.container.BlockProtection;
|
||||||
import com.gamingmesh.jobs.container.DBAction;
|
import com.gamingmesh.jobs.container.DBAction;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
|
|
||||||
public class BlockProtectionManager {
|
public class BlockProtectionManager {
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ public class BlockProtectionManager {
|
|||||||
|
|
||||||
locations.put(v, Bp);
|
locations.put(v, Bp);
|
||||||
|
|
||||||
if (locations.size() > 100) {
|
if (locations.size() > 10) {
|
||||||
Jobs.getJobsDAO().saveBlockProtection(loc.getWorld().getName(), new HashMap<String, BlockProtection>(locations));
|
Jobs.getJobsDAO().saveBlockProtection(loc.getWorld().getName(), new HashMap<String, BlockProtection>(locations));
|
||||||
locations.clear();
|
locations.clear();
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import com.gamingmesh.jobs.container.PlayerPoints;
|
|||||||
import com.gamingmesh.jobs.container.TopList;
|
import com.gamingmesh.jobs.container.TopList;
|
||||||
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
|
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
|
||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
@ -1031,7 +1032,7 @@ public abstract class JobsDAO {
|
|||||||
} finally {
|
} finally {
|
||||||
close(usersStatement);
|
close(usersStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement limitsStatement = null;
|
PreparedStatement limitsStatement = null;
|
||||||
try {
|
try {
|
||||||
limitsStatement = conn.prepareStatement("UPDATE `" + DBTables.LimitsTable.getTableName() + "` SET `" + LimitTableFields.typeid.getCollumn() + "` = ?, `" + LimitTableFields.type
|
limitsStatement = conn.prepareStatement("UPDATE `" + DBTables.LimitsTable.getTableName() + "` SET `" + LimitTableFields.typeid.getCollumn() + "` = ?, `" + LimitTableFields.type
|
||||||
@ -1047,8 +1048,7 @@ public abstract class JobsDAO {
|
|||||||
} finally {
|
} finally {
|
||||||
close(limitsStatement);
|
close(limitsStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordNewJobName(Job job) {
|
public void recordNewJobName(Job job) {
|
||||||
@ -2187,10 +2187,22 @@ public abstract class JobsDAO {
|
|||||||
if (conn == null)
|
if (conn == null)
|
||||||
return;
|
return;
|
||||||
PreparedStatement prest = null;
|
PreparedStatement prest = null;
|
||||||
|
PreparedStatement prestDel = null;
|
||||||
ResultSet res = null;
|
ResultSet res = null;
|
||||||
|
|
||||||
Jobs.getBpManager().timer = 0L;
|
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 {
|
try {
|
||||||
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.BlocksTable.getTableName() + "`;");
|
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.BlocksTable.getTableName() + "`;");
|
||||||
res = prest.executeQuery();
|
res = prest.executeQuery();
|
||||||
|
Loading…
Reference in New Issue
Block a user