paintballs wont change near portals.

This commit is contained in:
Chiss 2013-10-27 02:53:38 +11:00
parent 935599030b
commit d4affc8bb6

View File

@ -85,6 +85,7 @@ public class PaintballGun extends ItemGadget
public void Paint(ProjectileHitEvent event) public void Paint(ProjectileHitEvent event)
{ {
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49);
byte color = 2; byte color = 2;
double r = Math.random(); double r = Math.random();
@ -93,6 +94,12 @@ public class PaintballGun extends ItemGadget
else if (r > 0.4) color = 9; else if (r > 0.4) color = 9;
else if (r > 0.2) color = 14; else if (r > 0.2) color = 14;
for (Block block : UtilBlock.getInRadius(loc, 3d).keySet())
{
if (block.getType() == Material.PORTAL)
return;
}
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
{ {
if (!UtilBlock.solid(block)) if (!UtilBlock.solid(block))
@ -100,8 +107,6 @@ public class PaintballGun extends ItemGadget
Manager.Manager.GetBlockRestore().Add(block, 35, color, 4000); Manager.Manager.GetBlockRestore().Add(block, 35, color, 4000);
} }
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49);
} }
@EventHandler @EventHandler