Up the water damage check rate
This commit is contained in:
parent
59699f930e
commit
26d97bf7eb
@ -1084,41 +1084,40 @@ public class GameFlagManager implements Listener
|
||||
@EventHandler
|
||||
public void WorldWaterDamage(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
if (game == null) return;
|
||||
|
||||
if (!game.IsLive())
|
||||
return;
|
||||
|
||||
if (game.WorldWaterDamage <= 0)
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
{
|
||||
if (!game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||
{
|
||||
game.WorldWaterDamage = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (GameTeam team : game.GetTeamList())
|
||||
for (Player player : team.GetPlayers(true))
|
||||
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getRelative(BlockFace.UP).getTypeId() == 8 ||
|
||||
player.getLocation().getBlock().getTypeId() == 9 || player.getLocation().getBlock().getRelative(BlockFace.UP).getTypeId() == 9)
|
||||
{
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.DROWNING, game.WorldWaterDamage, true, false, false,
|
||||
"Water", "Water Damage");
|
||||
Game game = Manager.GetGame();
|
||||
if (game == null || !game.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.getWorld().playSound(player.getLocation(),
|
||||
Sound.SPLASH, 0.8f,
|
||||
1f + (float) Math.random() / 2);
|
||||
}
|
||||
if (game.WorldWaterDamage <= 0 && !game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||
{
|
||||
game.WorldWaterDamage = 4;
|
||||
}
|
||||
|
||||
for (Player player : game.GetPlayers(true))
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Water Damage", 500, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lower = block.getType();
|
||||
Material upper = block.getRelative(BlockFace.UP).getType();
|
||||
|
||||
if (lower == Material.WATER || lower == Material.STATIONARY_WATER || upper == Material.WATER || upper == Material.STATIONARY_WATER)
|
||||
{
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, game.WorldWaterDamage, true, false, false, "Water", "Water Damage");
|
||||
player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.8f, 1f + (float) Math.random() / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
Loading…
Reference in New Issue
Block a user