Various EarthTunnel fixes (#547)

-Fixed EarthTunnel dropping blocks
-Fixed EarthTunnel not breaking blocks from certain moves
-Fixed EarthTunnel on RaiseEarth leaving blocks behind
This commit is contained in:
Matt 2016-08-15 18:27:48 -04:00 committed by OmniCypher
parent 3c09394c53
commit 2a37e33864

View file

@ -1,9 +1,8 @@
package com.projectkorra.projectkorra.earthbending; package com.projectkorra.projectkorra.earthbending;
import com.projectkorra.projectkorra.GeneralMethods; import java.util.HashSet;
import com.projectkorra.projectkorra.ability.EarthAbility; import java.util.Map;
import com.projectkorra.projectkorra.configuration.ConfigManager; import java.util.concurrent.ConcurrentHashMap;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -11,9 +10,10 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.HashSet; import com.projectkorra.projectkorra.GeneralMethods;
import java.util.Map; import com.projectkorra.projectkorra.ability.EarthAbility;
import java.util.concurrent.ConcurrentHashMap; import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.util.TempBlock;
public class EarthTunnel extends EarthAbility { public class EarthTunnel extends EarthAbility {
@ -98,12 +98,15 @@ public class EarthTunnel extends EarthAbility {
block = location.clone().add(direction.clone().normalize().multiply(depth)).add(vec).getBlock(); block = location.clone().add(direction.clone().normalize().multiply(depth)).add(vec).getBlock();
} }
if (this.revert) { if (revert) {
airBlocks.put(new TempBlock(block, Material.AIR, (byte) 0), System.currentTimeMillis()); if (getMovedEarth().containsKey(block)) {
block.setType(Material.AIR);
} else { } else {
block.breakNaturally(); airBlocks.put(new TempBlock(block, Material.AIR, (byte) 0), System.currentTimeMillis());
}
} else {
block.setType(Material.AIR);
} }
return;
} }
} }
} }