Merge remote-tracking branch 'origin/clans-beta' into clans-beta

This commit is contained in:
Shaun Bennett 2015-07-16 15:51:29 -05:00
commit 096491f15d

View File

@ -26,6 +26,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -44,6 +45,13 @@ public class BlockToss extends SkillCharge implements IThrown
private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>(); private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>();
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>(); private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
private Material[] _blacklist = new Material[]
{
Material.TNT,
Material.IRON_DOOR,
Material.IRON_DOOR_BLOCK,
};
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
super(skills, name, classType, skillType, cost, levels, super(skills, name, classType, skillType, cost, levels,
@ -103,30 +111,14 @@ public class BlockToss extends SkillCharge implements IThrown
if (!Recharge.Instance.use(player, GetName(), 1000, false, false)) if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
return; return;
//Door //Blacklist
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71) for (Material mat : _blacklist)
{ if (mat == grab.getType())
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); return;
//Usable
if (UtilBlock.usable(grab))
return; return;
}
//TrapDoor or ladder
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
if (x != z && (z == 0 || x == 0))
{
Block block = grab.getRelative(x, 0, z);
if (block.getType() == Material.TRAP_DOOR || block.getType() == Material.LADDER)
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
}
}
}
}
//Block to Item //Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0); FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0);