Fixed broken commit 32688c5

This commit is contained in:
Intelli 2024-04-21 14:08:37 -06:00
parent 32688c55cf
commit b1598a022a
3 changed files with 13 additions and 11 deletions

View File

@ -42,7 +42,8 @@ public class BlockBreakLogger {
} }
if (!user.startsWith("#")) { if (!user.startsWith("#")) {
CacheHandler.spreadCache.remove(location); String cacheId = location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ() + "." + Util.getWorldId(location.getWorld().getName());
CacheHandler.spreadCache.remove(cacheId);
} }
if (checkType == Material.LECTERN) { if (checkType == Material.LECTERN) {

View File

@ -75,10 +75,10 @@ public final class BlockFromToListener extends Queue implements Listener {
} }
if (f.startsWith("#")) { if (f.startsWith("#")) {
Location location = toBlock.getLocation(); String cacheId = toBlock.getX() + "." + toBlock.getY() + "." + toBlock.getZ() + "." + Util.getWorldId(toBlock.getWorld().getName());
int timestamp = (int) (System.currentTimeMillis() / 1000L); int timestamp = (int) (System.currentTimeMillis() / 1000L);
Object[] cacheData = CacheHandler.spreadCache.get(location); Object[] cacheData = CacheHandler.spreadCache.get(cacheId);
CacheHandler.spreadCache.put(location, new Object[] { timestamp, type }); CacheHandler.spreadCache.put(cacheId, new Object[] { timestamp, type });
if (toBlockState == null && cacheData != null && ((Material) cacheData[1]) == type) { if (toBlockState == null && cacheData != null && ((Material) cacheData[1]) == type) {
return; return;
} }

View File

@ -82,14 +82,15 @@ public final class BlockSpreadListener extends Queue implements Listener {
} }
private boolean checkCacheData(Block block, Material type) { private boolean checkCacheData(Block block, Material type) {
int log = 0; String cacheId = block.getX() + "." + block.getY() + "." + block.getZ() + "." + Util.getWorldId(block.getWorld().getName());
String cacheId = block.getX() + "." + block.getY() + "." + block.getZ() + "." + Util.getWorldId(block.getWorld().getName()) + "." + type.name(); Location location = block.getLocation();
if (CacheHandler.spreadCache.get(cacheId) == null) {
log = 1;
}
int timestamp = (int) (System.currentTimeMillis() / 1000L); int timestamp = (int) (System.currentTimeMillis() / 1000L);
CacheHandler.spreadCache.put(cacheId, new Object[] { timestamp }); Object[] cacheData = CacheHandler.spreadCache.get(cacheId);
CacheHandler.spreadCache.put(cacheId, new Object[] { timestamp, type });
if (cacheData != null && ((Material) cacheData[1]) == type) {
return true;
}
return (log == 0); return false;
} }
} }