mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fixed memory issues with LavaFlow (#730)
This commit is contained in:
parent
da2b04a01c
commit
2fa49c945c
1 changed files with 11 additions and 3 deletions
|
@ -31,7 +31,9 @@ public class LavaFlow extends LavaAbility {
|
||||||
private static final Map<Block, TempBlock> TEMP_LAVA_BLOCKS = new ConcurrentHashMap<>();
|
private static final Map<Block, TempBlock> TEMP_LAVA_BLOCKS = new ConcurrentHashMap<>();
|
||||||
public static final Map<TempBlock, Block> TEMP_LAVA_BLOCKS_BY_TEMPBLOCK = new ConcurrentHashMap<>();
|
public static final Map<TempBlock, Block> TEMP_LAVA_BLOCKS_BY_TEMPBLOCK = new ConcurrentHashMap<>();
|
||||||
private static final Map<Block, TempBlock> TEMP_LAND_BLOCKS = new ConcurrentHashMap<>();
|
private static final Map<Block, TempBlock> TEMP_LAND_BLOCKS = new ConcurrentHashMap<>();
|
||||||
|
private static final Map<TempBlock, Block> TEMP_LAND_BLOCKS_BY_TEMPBLOCK = new ConcurrentHashMap<>();
|
||||||
private static final Map<Block, TempBlock> TEMP_AIR_BLOCKS = new ConcurrentHashMap<>();
|
private static final Map<Block, TempBlock> TEMP_AIR_BLOCKS = new ConcurrentHashMap<>();
|
||||||
|
private static final Map<TempBlock, Block> TEMP_AIR_BLOCKS_BY_TEMPBLOCK = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private boolean removing;
|
private boolean removing;
|
||||||
private boolean makeLava;
|
private boolean makeLava;
|
||||||
|
@ -387,10 +389,12 @@ public class LavaFlow extends LavaAbility {
|
||||||
if (isPlant(above) || isSnow(above)) {
|
if (isPlant(above) || isSnow(above)) {
|
||||||
TempBlock tb = new TempBlock(above, Material.AIR, (byte) 0);
|
TempBlock tb = new TempBlock(above, Material.AIR, (byte) 0);
|
||||||
TEMP_AIR_BLOCKS.put(above, tb);
|
TEMP_AIR_BLOCKS.put(above, tb);
|
||||||
|
TEMP_AIR_BLOCKS_BY_TEMPBLOCK.put(tb, above);
|
||||||
affectedBlocks.add(tb);
|
affectedBlocks.add(tb);
|
||||||
if (isPlant(above2) && above2.getType().equals(Material.DOUBLE_PLANT)) {
|
if (isPlant(above2) && above2.getType().equals(Material.DOUBLE_PLANT)) {
|
||||||
TempBlock tb2 = new TempBlock(above2, Material.AIR, (byte) 0);
|
TempBlock tb2 = new TempBlock(above2, Material.AIR, (byte) 0);
|
||||||
TEMP_AIR_BLOCKS.put(above2, tb2);
|
TEMP_AIR_BLOCKS.put(above2, tb2);
|
||||||
|
TEMP_AIR_BLOCKS_BY_TEMPBLOCK.put(tb2, above2);
|
||||||
affectedBlocks.add(tb);
|
affectedBlocks.add(tb);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -426,6 +430,7 @@ public class LavaFlow extends LavaAbility {
|
||||||
TempBlock tblock = new TempBlock(testBlock, revertMaterial, testBlock.getData());
|
TempBlock tblock = new TempBlock(testBlock, revertMaterial, testBlock.getData());
|
||||||
affectedBlocks.add(tblock);
|
affectedBlocks.add(tblock);
|
||||||
TEMP_LAND_BLOCKS.put(testBlock, tblock);
|
TEMP_LAND_BLOCKS.put(testBlock, tblock);
|
||||||
|
TEMP_LAND_BLOCKS_BY_TEMPBLOCK.put(tblock, testBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,11 +481,13 @@ public class LavaFlow extends LavaAbility {
|
||||||
}
|
}
|
||||||
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
|
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
|
||||||
affectedBlocks.remove(tblock);
|
affectedBlocks.remove(tblock);
|
||||||
TEMP_LAND_BLOCKS.remove(tblock);
|
TEMP_LAND_BLOCKS.remove(TEMP_LAND_BLOCKS_BY_TEMPBLOCK.get(tblock));
|
||||||
|
TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.remove(tblock);
|
||||||
}
|
}
|
||||||
if (TEMP_AIR_BLOCKS.values().contains(tblock)) {
|
if (TEMP_AIR_BLOCKS.values().contains(tblock)) {
|
||||||
affectedBlocks.remove(tblock);
|
affectedBlocks.remove(tblock);
|
||||||
TEMP_AIR_BLOCKS.remove(tblock);
|
TEMP_AIR_BLOCKS.remove(TEMP_AIR_BLOCKS_BY_TEMPBLOCK.get(tblock));
|
||||||
|
TEMP_AIR_BLOCKS_BY_TEMPBLOCK.remove(tblock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +513,8 @@ public class LavaFlow extends LavaAbility {
|
||||||
}
|
}
|
||||||
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
|
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
|
||||||
affectedBlocks.remove(tblock);
|
affectedBlocks.remove(tblock);
|
||||||
TEMP_LAND_BLOCKS.remove(tblock);
|
TEMP_LAND_BLOCKS.remove(TEMP_LAND_BLOCKS_BY_TEMPBLOCK.get(tblock));
|
||||||
|
TEMP_LAND_BLOCKS_BY_TEMPBLOCK.remove(tblock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue