Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
libraryaddict 2015-11-26 15:49:54 +13:00
commit 55ff04ca93
8 changed files with 111 additions and 39 deletions

View File

@ -1429,6 +1429,9 @@ public class MineStrike extends TeamGame
if (event.GetLog().GetLastDamager().GetReason().contains("AWP"))
amount = 100;
else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon"))
amount = 600;
else if (event.GetLog().GetLastDamager().GetReason().contains("Nova"))
amount = 900;
@ -1501,14 +1504,6 @@ public class MineStrike extends TeamGame
UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
//Expired
if (!grenadeItem.isValid() || grenadeItem.getTicksLived() > 400)
{
grenadeItem.remove();
grenadeIterator.remove();
continue;
}
//Completed
Grenade grenade = _grenadesThrown.get(grenadeItem);
if (grenade.update(this, grenadeItem))
@ -1680,11 +1675,15 @@ public class MineStrike extends TeamGame
{
for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true))
{
Block block = player.getTargetBlock((HashSet<Byte>) null, 5);
HashSet<Material> ignoreBlocks = new HashSet<Material>();
ignoreBlocks.add(Material.AIR);
ignoreBlocks.add(Material.PORTAL);
Block block = player.getTargetBlock(ignoreBlocks, 5);
if (block == null || !_bomb.isBlock(block))
continue;
if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
continue;
@ -1725,15 +1724,19 @@ public class MineStrike extends TeamGame
if (_bombDefuser == null)
return;
Block block = _bombDefuser.getTargetBlock((HashSet<Byte>) null, 5);
HashSet<Material> ignoreBlocks = new HashSet<Material>();
ignoreBlocks.add(Material.AIR);
ignoreBlocks.add(Material.PORTAL);
Block block = _bombDefuser.getTargetBlock(ignoreBlocks, 5);
if (!IsAlive(_bombDefuser) || block == null || !_bomb.isBlock(block) || !_bombDefuser.isOnline() || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
{
_bombDefuser.setExp(0f);
_bombDefuser = null;
_bombDefuser = null;
return;
}
//Kit or Not?
float defuseRate = 0.005f;
if (UtilGear.isMat(_bombDefuser.getInventory().getItem(8), Material.SHEARS))
@ -2429,6 +2432,21 @@ public class MineStrike extends TeamGame
}
}
@EventHandler
public void gunUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (Gun gun : _gunsEquipped.keySet())
{
gun.displayAmmo(_gunsEquipped.get(gun));
}
}
@EventHandler
public void smokeUpdate(UpdateEvent event)
{
@ -2443,9 +2461,15 @@ public class MineStrike extends TeamGame
if (System.currentTimeMillis() > _smokeBlocks.get(block))
{
block.setTypeIdAndData(0, (byte)0, false);
if (block.getType() == Material.PORTAL)
block.setTypeIdAndData(0, (byte)0, false);
smokeIterator.remove();
}
else if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(90, (byte)UtilMath.r(2), false);
}
}
}

View File

@ -34,10 +34,18 @@ public class Bomb
Block = planter.getLocation().getBlock();
Type = Block.getType();
Data = Block.getData();
if (Block.getType() != Material.PORTAL)
{
Type = Block.getType();
Data = Block.getData();
}
else
{
Type = Material.AIR;
Data = 0;
}
Block.setType(Material.DAYLIGHT_DETECTOR);
Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false);
StartTime = System.currentTimeMillis();
}
@ -45,7 +53,7 @@ public class Bomb
public boolean update()
{
if (Block.getType() != Material.DAYLIGHT_DETECTOR)
Block.setType(Material.DAYLIGHT_DETECTOR);
Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false);
double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime;

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio;
@ -34,7 +35,7 @@ public class FlashBang extends Grenade
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40)
if (UtilTime.elapsed(_throwTime, 2000))
{
FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build();
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
@ -46,7 +47,7 @@ public class FlashBang extends Grenade
continue;
//Line of Sight
Location loc = player.getEyeLocation();
Location loc = player.getEyeLocation();
boolean sight = true;
while (UtilMath.offset(loc, ent.getLocation()) > 0.5)

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -75,6 +76,8 @@ public abstract class Grenade extends StrikeItem
protected int _limit;
protected long _throwTime = 0;
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
{
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
@ -154,14 +157,19 @@ public abstract class Grenade extends StrikeItem
//Sound
playSound(game, player);
_throwTime = System.currentTimeMillis();
}
public boolean update(MineStrike game, Entity ent)
{
//Invalid
if (!ent.isValid())
if (UtilTime.elapsed(_throwTime, 20000))
return true;
//Invalid (Burned)
if (!ent.isValid())
return updateCustom(game, ent);
//Rebound Off Blocks
rebound(ent);
@ -174,7 +182,7 @@ public abstract class Grenade extends StrikeItem
public void rebound(Entity ent)
{
if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || ent.getTicksLived() < 4)
if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || !UtilTime.elapsed(_throwTime, 200))
return;
if (Math.abs(_vel.getX()) < 0.1 && Math.abs(_vel.getX()) < 0.1)

View File

@ -6,6 +6,7 @@ import java.util.List;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
@ -35,7 +36,7 @@ public class HighExplosive extends Grenade
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40)
if (UtilTime.elapsed(_throwTime, 2000))
{
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
ent.getLocation(), 0, 0, 0, 0, 1,

View File

@ -6,6 +6,7 @@ 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.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam;
@ -37,7 +38,7 @@ public class Smoke extends Grenade
@Override
public boolean updateCustom(final MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40 && UtilEnt.isGrounded(ent))
if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid()))
{
// UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers());
@ -55,7 +56,7 @@ public class Smoke extends Grenade
final int round = game.getRound();
for (final Block block : blocks.keySet())
{
if (block.getType() != Material.AIR)
if (block.getType() != Material.AIR && block.getType() != Material.PORTAL && block.getType() != Material.FIRE)
continue;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
@ -84,7 +85,7 @@ public class Smoke extends Grenade
}
//18 seconds
return ent.getTicksLived() > 360;
return UtilTime.elapsed(_throwTime, 18000);
}
@Override

View File

@ -47,6 +47,8 @@ public class Gun extends StrikeItem
protected long _lastMoveTime;
protected boolean _reloading = false;
protected boolean _reloadTick = false;
public Gun(GunStats gunStats)
{
@ -124,17 +126,25 @@ public class Gun extends StrikeItem
//Use Ammo
_loadedAmmo--;
updateWeaponName(player);
//updateWeaponName(player);
//Effect
soundFire(player.getLocation());
//Visual
//Smoke
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3));
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1,
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.4));
UtilParticle.PlayParticle(Math.random() > 0.5 ? ParticleType.ANGRY_VILLAGER : ParticleType.HEART, loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
//Shell
loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(0.6));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.7));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.5));
UtilParticle.PlayParticle(ParticleType.SPLASH, loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
game.registerBullet(fireBullet(player, game));
@ -265,7 +275,7 @@ public class Gun extends StrikeItem
}
//Recharge
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true, true);
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
//Sound
soundReload(player.getLocation());
@ -284,17 +294,36 @@ public class Gun extends StrikeItem
{
updateWeaponName(null);
}
public void displayAmmo(Player player)
{
if (!UtilGear.isMat(player.getItemInHand(), getStack().getType()))
return;
//Weapon Bob during reload
if (_reloading)
updateWeaponName(player);
if (!Recharge.Instance.usable(player, getName() + " Reload"))
return;
if (_loadedAmmo > 0 || _reserveAmmo > 0)
UtilTextBottom.display(C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo, player);
else
UtilTextBottom.display(C.cRed + "No Ammo", player);
}
public void updateWeaponName(Player player)
{
ItemMeta meta = getStack().getItemMeta();
meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo);
meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + (_reloadTick ? ChatColor.RED : ChatColor.WHITE));
getStack().setItemMeta(meta);
getStack().setAmount(Math.max(1, _loadedAmmo));
if (player != null)
{
player.getInventory().setItem(_slot, getStack());
_reloadTick = !_reloadTick;
}
}
public double getDropOff()
@ -349,7 +378,7 @@ public class Gun extends StrikeItem
_reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize());
//Update
updateWeaponName(player);
//updateWeaponName(player);
//Sound
player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f);
@ -417,7 +446,7 @@ public class Gun extends StrikeItem
_loadedAmmo = _gunStats.getClipSize();
_reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize();
updateWeaponName(player);
//updateWeaponName(player);
}
public double getDamage()

View File

@ -43,7 +43,7 @@ public class Shotgun extends Gun
//Use Ammo
_loadedAmmo--;
updateWeaponName(player);
//updateWeaponName(false);
//Effect
soundFire(player.getLocation());