minestrike update!
This commit is contained in:
parent
d66bad572f
commit
8ceb6ccfca
@ -211,6 +211,7 @@ public class MineStrike extends TeamGame
|
||||
private HashSet<Entity> _defusalDropped = new HashSet<Entity>();
|
||||
|
||||
private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>();
|
||||
private HashMap<Block, Long> _smokeBlocks = new HashMap<Block, Long>();
|
||||
|
||||
private Bomb _bomb = null;
|
||||
private Item _bombItem = null;
|
||||
@ -612,6 +613,17 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
_incendiary.put(loc, endTime);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void registerSmokeBlock(Block block, long endTime)
|
||||
{
|
||||
if (block.getType() == Material.AIR || block.getType() == Material.PORTAL || block.getType() == Material.FIRE)
|
||||
{
|
||||
block.setTypeIdAndData(90, (byte)UtilMath.r(2), false);
|
||||
|
||||
_smokeBlocks.put(block, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
public Gun getGunInHand(Player player, ItemStack overrideStack)
|
||||
{
|
||||
@ -728,7 +740,7 @@ public class MineStrike extends TeamGame
|
||||
if (grenade == null)
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 15000))
|
||||
if (!UtilTime.elapsed(GetStateTime(), 10000))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot throw Grenades yet."));
|
||||
return;
|
||||
@ -2160,6 +2172,11 @@ public class MineStrike extends TeamGame
|
||||
//Incendiary
|
||||
_incendiary.clear();
|
||||
Manager.GetBlockRestore().RestoreAll();
|
||||
|
||||
//Smoke
|
||||
for (Block block : _smokeBlocks.keySet())
|
||||
block.setType(Material.AIR);
|
||||
_smokeBlocks.clear();
|
||||
|
||||
//Restock Ammo
|
||||
for (Gun gun : _gunsEquipped.keySet())
|
||||
@ -2411,6 +2428,26 @@ public class MineStrike extends TeamGame
|
||||
loc.getWorld().playSound(loc, Sound.PIG_DEATH, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void smokeUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Block> smokeIterator = _smokeBlocks.keySet().iterator();
|
||||
|
||||
while (smokeIterator.hasNext())
|
||||
{
|
||||
Block block = smokeIterator.next();
|
||||
|
||||
if (System.currentTimeMillis() > _smokeBlocks.get(block))
|
||||
{
|
||||
block.setTypeIdAndData(0, (byte)0, false);
|
||||
smokeIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void bombBurnUpdate(UpdateEvent event)
|
||||
|
@ -236,14 +236,15 @@ public class ShopManager
|
||||
Host.registerGrenade(grenade, player);
|
||||
}
|
||||
|
||||
//Use 250 instead of 255, to show that its kevlar/helmet
|
||||
else if (item instanceof Helmet)
|
||||
{
|
||||
((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(255, 75, 75) : Color.fromRGB(125, 200, 255));
|
||||
((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(250, 75, 75) : Color.fromRGB(125, 200, 250));
|
||||
}
|
||||
|
||||
else if (item instanceof Kevlar)
|
||||
{
|
||||
((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(255, 75, 75) : Color.fromRGB(125, 200, 255));
|
||||
((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(250, 75, 75) : Color.fromRGB(125, 200, 250));
|
||||
}
|
||||
|
||||
else if (item instanceof DefusalKit)
|
||||
|
@ -54,7 +54,7 @@ public class Armor extends StrikeItem
|
||||
try
|
||||
{
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
|
||||
return (meta.getColor().getBlue() == 100 || meta.getColor().getRed() == 100);
|
||||
return (meta.getColor().getBlue() == 250 || meta.getColor().getRed() == 250);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -74,6 +74,19 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
continue;
|
||||
|
||||
//Smoke
|
||||
boolean nearSmoke = false;
|
||||
for (Block other : UtilBlock.getSurrounding(block, false))
|
||||
{
|
||||
if (other.getType() == Material.PORTAL)
|
||||
{
|
||||
nearSmoke = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nearSmoke)
|
||||
continue;
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
|
@ -1,5 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
@ -12,11 +16,15 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Smoke extends Grenade
|
||||
{
|
||||
private boolean _createdBlocks = false;
|
||||
|
||||
public Smoke()
|
||||
{
|
||||
super("Smoke", new String[]
|
||||
@ -27,27 +35,55 @@ public class Smoke extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(final MineStrike game, Entity ent)
|
||||
{
|
||||
if (ent.getTicksLived() > 60)
|
||||
if (ent.getTicksLived() > 40 && UtilEnt.isGrounded(ent))
|
||||
{
|
||||
// UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1,
|
||||
// ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, ent.getLocation(), 1.5f, 1.5f, 1.5f, 0, 100,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
|
||||
|
||||
//Remove Fire
|
||||
for (Location loc : game.Manager.GetBlockRestore().RestoreBlockAround(Material.FIRE, ent.getLocation(), 5))
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f);
|
||||
}
|
||||
|
||||
//Smoke Blocks
|
||||
if (!_createdBlocks)
|
||||
{
|
||||
final HashMap<Block, Double> blocks = UtilBlock.getInRadius(ent.getLocation().add(0, 1, 0), 4d);
|
||||
final int round = game.getRound();
|
||||
for (final Block block : blocks.keySet())
|
||||
{
|
||||
if (block.getType() != Material.AIR)
|
||||
continue;
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (round == game.getRound() && !game.isFreezeTime())
|
||||
{
|
||||
//18 seconds
|
||||
long duration = (long) (15000 + blocks.get(block) * 3000);
|
||||
|
||||
game.registerSmokeBlock(block, System.currentTimeMillis() + duration);
|
||||
}
|
||||
}
|
||||
}, 10 - (int)(10d * blocks.get(block)));
|
||||
}
|
||||
|
||||
_createdBlocks = true;
|
||||
}
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//18 seconds
|
||||
return ent.getTicksLived() > 360;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user