From 34be68bb40b1aec57025d4c4429ab4206eceb002 Mon Sep 17 00:00:00 2001 From: Sobki Date: Sat, 11 Feb 2017 17:26:33 +1000 Subject: [PATCH] Fixed memory issues with PhaseChange and Torrent. (#727) Thanks to PhanaticD for reporting these issues. --- src/com/projectkorra/projectkorra/waterbending/Torrent.java | 3 ++- .../projectkorra/waterbending/ice/PhaseChange.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/projectkorra/projectkorra/waterbending/Torrent.java b/src/com/projectkorra/projectkorra/waterbending/Torrent.java index 5345bf59..d5a0956c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/Torrent.java +++ b/src/com/projectkorra/projectkorra/waterbending/Torrent.java @@ -582,7 +582,8 @@ public class Torrent extends WaterAbility { Player player = FROZEN_BLOCKS.get(block); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { - return; + FROZEN_BLOCKS.remove(block); + continue; } else if (block.getBlock().getType() != Material.ICE) { FROZEN_BLOCKS.remove(block); continue; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java b/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java index 0c20078b..735cc612 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java @@ -431,10 +431,10 @@ public class PhaseChange extends IceAbility { public void revertFrozenBlocks() { if (active_types.contains(PhaseChangeType.FREEZE)) { for (TempBlock tb : blocks) { + PLAYER_BY_BLOCK.remove(tb); tb.revertBlock(); } blocks.clear(); - PLAYER_BY_BLOCK.remove(player); } }