Per player fireworks

This commit is contained in:
Sam 2016-08-05 22:11:15 +01:00
parent 2c6fc85fee
commit e6bdfe8ba7

View File

@ -12,6 +12,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
@ -23,6 +24,7 @@ public class PowerupGenerator
{
private static final int ARROWS_TO_GIVE = 2;
private static final int FIREWORK_VIEW_DISTANCE = 10;
private QuiverPayload Host;
@ -61,7 +63,7 @@ public class PowerupGenerator
_item.setVelocity(new Vector(0, 1, 0));
_item.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.GOLD_BLOCK);
UtilFirework.playFirework(_location, Type.BALL_LARGE, Color.YELLOW, false, true);
playFirework();
}
}
@ -94,16 +96,16 @@ public class PowerupGenerator
return;
}
_lastPickup = System.currentTimeMillis();
_item.remove();
_item = null;
_lastPickup = System.currentTimeMillis();
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
UtilServer.broadcast(C.cYellowB + player.getName() + C.cWhiteB + " collected the " + C.cYellowB + "Resupply" + C.cWhiteB + " Powerup.");
UtilFirework.playFirework(_location, Type.BALL_LARGE, Color.YELLOW, false, true);
playFirework();
ItemStack itemStack = Quiver.SUPER_ARROW.clone();
@ -116,7 +118,23 @@ public class PowerupGenerator
itemStack.setAmount(ARROWS_TO_GIVE);
}
if (itemStack == null)
{
return;
}
player.getInventory().addItem(itemStack);
}
private void playFirework()
{
for (Player player : UtilServer.getPlayers())
{
if (UtilMath.offset(_location, player.getLocation()) < FIREWORK_VIEW_DISTANCE)
{
UtilFirework.packetPlayFirework(player, _location, Type.BALL_LARGE, Color.YELLOW, false, true);
}
}
}
}