1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-03-11 22:31:04 +01:00

lets not add into cache when loading data

This commit is contained in:
Zrips 2019-10-30 10:36:35 +02:00
parent 536eac2613
commit 4cf033618b
3 changed files with 8 additions and 7 deletions

View File

@ -53,12 +53,12 @@ public class BlockProtectionManager {
if (cd == null)
return;
if (cd != -1)
addP(loc, System.currentTimeMillis() + (cd * 1000), paid);
addP(loc, System.currentTimeMillis() + (cd * 1000), paid, true);
else
addP(loc, -1L, paid);
addP(loc, -1L, paid, true);
}
public BlockProtection addP(Location loc, Long time, boolean paid) {
public BlockProtection addP(Location loc, Long time, boolean paid, boolean cache) {
String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
HashMap<String, HashMap<String, HashMap<String, BlockProtection>>> regions = map.get(loc.getWorld());
if (regions == null)
@ -85,7 +85,8 @@ public class BlockProtectionManager {
chunks.put(chunk, Bpm);
regions.put(region, chunks);
map.put(loc.getWorld(), regions);
addToCache(loc, Bp);
if (cache)
addToCache(loc, Bp);
return Bp;
}

View File

@ -2258,7 +2258,7 @@ public abstract class JobsDAO {
int z = res.getInt(BlockTableFields.z.getCollumn());
long resets = res.getLong(BlockTableFields.resets.getCollumn());
Location loc = new Location(world, x, y, z);
BlockProtection bp = Jobs.getBpManager().addP(loc, resets, true);
BlockProtection bp = Jobs.getBpManager().addP(loc, resets, true, false);
bp.setId(id);
long t = System.currentTimeMillis();
bp.setRecorded(res.getLong(BlockTableFields.recorded.getCollumn()));

View File

@ -37,7 +37,7 @@ public class PistonProtectionListener implements Listener {
Long bp = Jobs.getBpManager().getTime(oldLoc);
if (bp != null) {
Jobs.getBpManager().addP(newLoc, bp, true);
Jobs.getBpManager().addP(newLoc, bp, true, true);
Jobs.getBpManager().remove(oldLoc);
} else {
Integer cd = Jobs.getBpManager().getBlockDelayTime(one);
@ -72,7 +72,7 @@ public class PistonProtectionListener implements Listener {
Location newLoc = oldLoc.clone().add(x, y, z);
Long bp = Jobs.getBpManager().getTime(oldLoc);
if (bp != null) {
Jobs.getBpManager().addP(newLoc, bp, true);
Jobs.getBpManager().addP(newLoc, bp, true, true);
Jobs.getBpManager().remove(oldLoc);
} else {
Integer cd = Jobs.getBpManager().getBlockDelayTime(one);