From bc196a95e00c5640c15912e269a7f8d8da6bf345 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 12 Apr 2016 21:01:10 -0500 Subject: [PATCH] Fixed EarthBlast / WaterManipulation being able to make moves off of eachothers blocks --- src/com/projectkorra/projectkorra/util/BlockSource.java | 5 +++++ src/com/projectkorra/projectkorra/util/TempBlock.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/projectkorra/projectkorra/util/BlockSource.java b/src/com/projectkorra/projectkorra/util/BlockSource.java index 5a73b490..dfd0a2e0 100644 --- a/src/com/projectkorra/projectkorra/util/BlockSource.java +++ b/src/com/projectkorra/projectkorra/util/BlockSource.java @@ -115,6 +115,7 @@ public class BlockSource { * @return a valid bendable block, or null if none was found. */ public static BlockSourceInformation getBlockSourceInformation(Player player, BlockSourceType sourceType, ClickType clickType) { + if (!playerSources.containsKey(player)) { return null; } else if (!playerSources.get(player).containsKey(sourceType)) { @@ -152,6 +153,9 @@ public class BlockSource { */ public static Block getSourceBlock(Player player, double range, BlockSourceType sourceType, ClickType clickType) { BlockSourceInformation info = getValidBlockSourceInformation(player, range, sourceType, clickType); + if (TempBlock.isTempBlock(info.getBlock())) { + return null; + } return info != null ? info.getBlock() : null; } @@ -282,6 +286,7 @@ public class BlockSource { */ public static Block getEarthSourceBlock(Player player, double range, ClickType clickType, boolean allowNearbySubstitute) { Block sourceBlock = getSourceBlock(player, range, BlockSourceType.EARTH, clickType); + if (sourceBlock == null && allowNearbySubstitute) { BlockSourceInformation blockInfo = getBlockSourceInformation(player, BlockSourceType.EARTH, clickType); diff --git a/src/com/projectkorra/projectkorra/util/TempBlock.java b/src/com/projectkorra/projectkorra/util/TempBlock.java index 19fce95a..f39d3db8 100644 --- a/src/com/projectkorra/projectkorra/util/TempBlock.java +++ b/src/com/projectkorra/projectkorra/util/TempBlock.java @@ -126,4 +126,4 @@ public class TempBlock { block.setData(data); } -} +} \ No newline at end of file