snowfight finish
This commit is contained in:
parent
1e441ac017
commit
d75d7a2c8f
@ -72,7 +72,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class SnowFight extends TeamGame
|
||||
{
|
||||
private long _meteorTime = 10000;
|
||||
private long _meteorTime = 240000;
|
||||
private boolean _meteors = false;
|
||||
|
||||
private HashSet<FallingBlock> _meteorSet = new HashSet<FallingBlock>();
|
||||
@ -104,20 +104,20 @@ public class SnowFight extends TeamGame
|
||||
this.TeamArmor = true;
|
||||
this.TeamArmorHotbar = true;
|
||||
|
||||
this.WorldWeatherEnabled = true;
|
||||
this.WorldTimeSet = 4000;
|
||||
// this.WorldWeatherEnabled = true;
|
||||
// this.WorldTimeSet = 4000;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void weather(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
WorldData.World.setStorm(true);
|
||||
WorldData.World.setThundering(false);
|
||||
WorldData.World.setWeatherDuration(10);
|
||||
}
|
||||
// @EventHandler
|
||||
// public void weather(UpdateEvent event)
|
||||
// {
|
||||
// if (event.getType() != UpdateType.SEC)
|
||||
// return;
|
||||
//
|
||||
// WorldData.World.setStorm(true);
|
||||
// WorldData.World.setThundering(false);
|
||||
// WorldData.World.setWeatherDuration(12);
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void battleAnnounce(GameStateChangeEvent event)
|
||||
@ -243,7 +243,36 @@ public class SnowFight extends TeamGame
|
||||
|
||||
private boolean isOnIce(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE;
|
||||
//Side Standing
|
||||
double xMod = player.getLocation().getX() % 1;
|
||||
if (player.getLocation().getX() < 0)
|
||||
xMod += 1;
|
||||
|
||||
double zMod = player.getLocation().getZ() % 1;
|
||||
if (player.getLocation().getZ() < 0)
|
||||
zMod += 1;
|
||||
|
||||
int xMin = 0;
|
||||
int xMax = 0;
|
||||
int zMin = 0;
|
||||
int zMax = 0;
|
||||
|
||||
if (xMod < 0.3) xMin = -1;
|
||||
if (xMod > 0.7) xMax = 1;
|
||||
|
||||
if (zMod < 0.3) zMin = -1;
|
||||
if (zMod > 0.7) zMax = 1;
|
||||
|
||||
for (int x=xMin ; x<=xMax ; x++)
|
||||
{
|
||||
for (int z=zMin ; z<=zMax ; z++)
|
||||
{
|
||||
if (player.getLocation().add(x, -0.5, z).getBlock().getType() == Material.PACKED_ICE)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Location getMeteorTargetLocation()
|
||||
@ -362,7 +391,7 @@ public class SnowFight extends TeamGame
|
||||
|
||||
float multiplier = 1 + Math.min(3f, timePassed / 60f);
|
||||
|
||||
float size = 2 + multiplier;
|
||||
float size = 1.5f + multiplier;
|
||||
|
||||
if (projectile.hasMetadata("Meteor"))
|
||||
{
|
||||
@ -391,9 +420,12 @@ public class SnowFight extends TeamGame
|
||||
int i = 5;
|
||||
while (block.getY() > 0 && i>0)
|
||||
{
|
||||
if (block.getType() == Material.LADDER)
|
||||
if (block.getType() == Material.LADDER ||
|
||||
block.getType() == Material.STAINED_GLASS ||
|
||||
block.getType() == Material.STAINED_GLASS_PANE)
|
||||
block.breakNaturally();
|
||||
|
||||
|
||||
//Has air above it
|
||||
if (UtilBlock.solid(block) && UtilBlock.isVisible(block))
|
||||
block.setType(Material.PACKED_ICE);
|
||||
@ -423,7 +455,7 @@ public class SnowFight extends TeamGame
|
||||
//XXX DO BETTER CHECK, hanging off block, ladders, etc.
|
||||
if(isOnIce(player))
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 0.5, false, true, true, "Ice", "Ice", false));
|
||||
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user