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;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.util.TempBlock;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
import org.bukkit.Material;
@ -11,9 +10,10 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.util.TempBlock;
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();
}
if (this.revert) {
airBlocks.put(new TempBlock(block, Material.AIR, (byte) 0), System.currentTimeMillis());
if (revert) {
if (getMovedEarth().containsKey(block)) {
block.setType(Material.AIR);
} else {
airBlocks.put(new TempBlock(block, Material.AIR, (byte) 0), System.currentTimeMillis());
}
} else {
block.breakNaturally();
block.setType(Material.AIR);
}
return;
}
}
}