Fix Fissure skipping snow blocks

This commit is contained in:
Sam 2017-04-28 19:30:19 +01:00
parent 6beeec20d6
commit 8a54e19695
2 changed files with 26 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.perks.snowman;
import java.util.Map; import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -56,6 +57,11 @@ public class PerkArcticAura extends Perk
for (Block block : blocks.keySet()) for (Block block : blocks.keySet())
{ {
if (block.getType() == Material.SNOW_BLOCK)
{
continue;
}
Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (_duration * (1 + blocks.get(block))), 250, 0); Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (_duration * (1 + blocks.get(block))), 250, 0);
} }
} }

View File

@ -3,8 +3,10 @@ package nautilus.game.arcade.kit.perks.data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -69,12 +71,12 @@ public class FissureData
continue; continue;
//Move up 1, cant go 2 up //Move up 1, cant go 2 up
if (UtilBlock.solid(block.getRelative(BlockFace.UP))) if (isSolid(block.getRelative(BlockFace.UP)))
{ {
_loc.add(0, 1, 0); _loc.add(0, 1, 0);
block = _loc.getBlock(); block = _loc.getBlock();
if (UtilBlock.solid(block.getRelative(BlockFace.UP))) if (isSolid(block.getRelative(BlockFace.UP)))
{ {
return; return;
} }
@ -82,12 +84,12 @@ public class FissureData
} }
//Move down 1, cant go 2 down //Move down 1, cant go 2 down
else if (!UtilBlock.solid(block)) else if (!isSolid(block))
{ {
_loc.add(0, -1, 0); _loc.add(0, -1, 0);
block = _loc.getBlock(); block = _loc.getBlock();
if (!UtilBlock.solid(block)) if (!isSolid(block))
{ {
return; return;
} }
@ -139,7 +141,15 @@ public class FissureData
if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().add(block, 3, block.getData(), 14000); if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().add(block, 3, block.getData(), 14000);
if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().add(block, 98, (byte) 2, 14000); if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().add(block, 98, (byte) 2, 14000);
Host.Manager.GetBlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); if (block.getType() == Material.SNOW)
{
Host.Manager.GetBlockRestore().add(block, Material.SNOW_BLOCK.getId(), (byte) 0, 10000 - (1000 * _height));
Host.Manager.GetBlockRestore().add(up, Material.SNOW_BLOCK.getId(), (byte) 0, 10000 - (1000 * _height));
}
else
{
Host.Manager.GetBlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height));
}
_height++; _height++;
//Effect //Effect
@ -212,4 +222,9 @@ public class FissureData
_loc = null; _loc = null;
_startLoc = null; _startLoc = null;
} }
private boolean isSolid(Block block)
{
return UtilBlock.solid(block) || block.getType() == Material.SNOW;
}
} }