From 3539389e1add99d189a8012548d5bfc0c09c51b4 Mon Sep 17 00:00:00 2001 From: Sobki Date: Tue, 31 Jan 2017 03:56:35 +1000 Subject: [PATCH] Fixed TEMP_LAVA_BLOCKS not removing key from Map (#714) --- .../projectkorra/earthbending/lava/LavaFlow.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java index 94ff748b..7fe42309 100644 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java +++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java @@ -29,6 +29,7 @@ public class LavaFlow extends LavaAbility { } private static final Map TEMP_LAVA_BLOCKS = new ConcurrentHashMap<>(); + public static final Map TEMP_LAVA_BLOCKS_BY_TEMPBLOCK = new ConcurrentHashMap<>(); private static final Map TEMP_LAND_BLOCKS = new ConcurrentHashMap<>(); private static final Map TEMP_AIR_BLOCKS = new ConcurrentHashMap<>(); @@ -397,6 +398,7 @@ public class LavaFlow extends LavaAbility { } TempBlock tblock = new TempBlock(block, Material.LAVA, (byte) 0); TEMP_LAVA_BLOCKS.put(block, tblock); + TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.put(tblock, block); affectedBlocks.add(tblock); if (allowNaturalFlow) { @@ -416,6 +418,7 @@ public class LavaFlow extends LavaAbility { TempBlock tb = TEMP_LAVA_BLOCKS.get(testBlock); tb.revertBlock(); TEMP_LAVA_BLOCKS.remove(testBlock); + TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.remove(tb); affectedBlocks.remove(tb); return; } @@ -468,7 +471,8 @@ public class LavaFlow extends LavaAbility { if (TEMP_LAVA_BLOCKS.values().contains(tblock)) { affectedBlocks.remove(tblock); - TEMP_LAVA_BLOCKS.remove(tblock); + TEMP_LAVA_BLOCKS.remove(TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.get(tblock)); + TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.remove(tblock); } if (TEMP_LAND_BLOCKS.values().contains(tblock)) { affectedBlocks.remove(tblock); @@ -497,7 +501,8 @@ public class LavaFlow extends LavaAbility { tblock.revertBlock(); if (TEMP_LAVA_BLOCKS.values().contains(tblock)) { affectedBlocks.remove(tblock); - TEMP_LAVA_BLOCKS.remove(tblock); + TEMP_LAVA_BLOCKS.remove(TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.get(tblock)); + TEMP_LAVA_BLOCKS_BY_TEMPBLOCK.remove(tblock); } if (TEMP_LAND_BLOCKS.values().contains(tblock)) { affectedBlocks.remove(tblock);