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")) if (event.GetLog().GetLastDamager().GetReason().contains("AWP"))
amount = 100; amount = 100;
else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon"))
amount = 600;
else if (event.GetLog().GetLastDamager().GetReason().contains("Nova")) else if (event.GetLog().GetLastDamager().GetReason().contains("Nova"))
amount = 900; amount = 900;
@ -1501,14 +1504,6 @@ public class MineStrike extends TeamGame
UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers()); ViewDist.NORMAL, UtilServer.getPlayers());
//Expired
if (!grenadeItem.isValid() || grenadeItem.getTicksLived() > 400)
{
grenadeItem.remove();
grenadeIterator.remove();
continue;
}
//Completed //Completed
Grenade grenade = _grenadesThrown.get(grenadeItem); Grenade grenade = _grenadesThrown.get(grenadeItem);
if (grenade.update(this, grenadeItem)) if (grenade.update(this, grenadeItem))
@ -1680,11 +1675,15 @@ public class MineStrike extends TeamGame
{ {
for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true)) 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)) if (block == null || !_bomb.isBlock(block))
continue; continue;
if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3) if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
continue; continue;
@ -1725,15 +1724,19 @@ public class MineStrike extends TeamGame
if (_bombDefuser == null) if (_bombDefuser == null)
return; 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) 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.setExp(0f);
_bombDefuser = null; _bombDefuser = null;
return; return;
} }
//Kit or Not? //Kit or Not?
float defuseRate = 0.005f; float defuseRate = 0.005f;
if (UtilGear.isMat(_bombDefuser.getInventory().getItem(8), Material.SHEARS)) 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 @EventHandler
public void smokeUpdate(UpdateEvent event) public void smokeUpdate(UpdateEvent event)
{ {
@ -2443,9 +2461,15 @@ public class MineStrike extends TeamGame
if (System.currentTimeMillis() > _smokeBlocks.get(block)) 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(); 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(); Block = planter.getLocation().getBlock();
Type = Block.getType(); if (Block.getType() != Material.PORTAL)
Data = Block.getData(); {
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(); StartTime = System.currentTimeMillis();
} }
@ -45,7 +53,7 @@ public class Bomb
public boolean update() public boolean update()
{ {
if (Block.getType() != Material.DAYLIGHT_DETECTOR) 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; 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.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio; import nautilus.game.arcade.game.games.minestrike.Radio;
@ -34,7 +35,7 @@ public class FlashBang extends Grenade
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) 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(); 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); UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
@ -46,7 +47,7 @@ public class FlashBang extends Grenade
continue; continue;
//Line of Sight //Line of Sight
Location loc = player.getEyeLocation(); Location loc = player.getEyeLocation();
boolean sight = true; boolean sight = true;
while (UtilMath.offset(loc, ent.getLocation()) > 0.5) 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.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; 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.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem; import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType; import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -75,6 +76,8 @@ public abstract class Grenade extends StrikeItem
protected int _limit; protected int _limit;
protected long _throwTime = 0;
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit) public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
{ {
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin); super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
@ -154,14 +157,19 @@ public abstract class Grenade extends StrikeItem
//Sound //Sound
playSound(game, player); playSound(game, player);
_throwTime = System.currentTimeMillis();
} }
public boolean update(MineStrike game, Entity ent) public boolean update(MineStrike game, Entity ent)
{ {
//Invalid if (UtilTime.elapsed(_throwTime, 20000))
if (!ent.isValid())
return true; return true;
//Invalid (Burned)
if (!ent.isValid())
return updateCustom(game, ent);
//Rebound Off Blocks //Rebound Off Blocks
rebound(ent); rebound(ent);
@ -174,7 +182,7 @@ public abstract class Grenade extends StrikeItem
public void rebound(Entity ent) 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; return;
if (Math.abs(_vel.getX()) < 0.1 && Math.abs(_vel.getX()) < 0.1) 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.UtilParticle;
import mineplex.core.common.util.UtilServer; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -35,7 +36,7 @@ public class HighExplosive extends Grenade
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) public boolean updateCustom(MineStrike game, Entity ent)
{ {
if (ent.getTicksLived() > 40) if (UtilTime.elapsed(_throwTime, 2000))
{ {
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
ent.getLocation(), 0, 0, 0, 0, 1, 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.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
@ -37,7 +38,7 @@ public class Smoke extends Grenade
@Override @Override
public boolean updateCustom(final MineStrike game, Entity ent) 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, // UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers()); // ViewDist.MAX, UtilServer.getPlayers());
@ -55,7 +56,7 @@ public class Smoke extends Grenade
final int round = game.getRound(); final int round = game.getRound();
for (final Block block : blocks.keySet()) 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; continue;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable() UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
@ -84,7 +85,7 @@ public class Smoke extends Grenade
} }
//18 seconds //18 seconds
return ent.getTicksLived() > 360; return UtilTime.elapsed(_throwTime, 18000);
} }
@Override @Override

View File

@ -47,6 +47,8 @@ public class Gun extends StrikeItem
protected long _lastMoveTime; protected long _lastMoveTime;
protected boolean _reloading = false; protected boolean _reloading = false;
protected boolean _reloadTick = false;
public Gun(GunStats gunStats) public Gun(GunStats gunStats)
{ {
@ -124,17 +126,25 @@ public class Gun extends StrikeItem
//Use Ammo //Use Ammo
_loadedAmmo--; _loadedAmmo--;
updateWeaponName(player); //updateWeaponName(player);
//Effect //Effect
soundFire(player.getLocation()); soundFire(player.getLocation());
//Visual //Smoke
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2)); Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5)); loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3)); loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.4));
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1, UtilParticle.PlayParticle(Math.random() > 0.5 ? ParticleType.ANGRY_VILLAGER : ParticleType.HEART, loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers()); 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)); game.registerBullet(fireBullet(player, game));
@ -265,7 +275,7 @@ public class Gun extends StrikeItem
} }
//Recharge //Recharge
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true, true); Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
//Sound //Sound
soundReload(player.getLocation()); soundReload(player.getLocation());
@ -284,17 +294,36 @@ public class Gun extends StrikeItem
{ {
updateWeaponName(null); 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) public void updateWeaponName(Player player)
{ {
ItemMeta meta = getStack().getItemMeta(); 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().setItemMeta(meta);
getStack().setAmount(Math.max(1, _loadedAmmo));
if (player != null) if (player != null)
{
player.getInventory().setItem(_slot, getStack()); player.getInventory().setItem(_slot, getStack());
_reloadTick = !_reloadTick;
}
} }
public double getDropOff() public double getDropOff()
@ -349,7 +378,7 @@ public class Gun extends StrikeItem
_reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize()); _reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize());
//Update //Update
updateWeaponName(player); //updateWeaponName(player);
//Sound //Sound
player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f); player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f);
@ -417,7 +446,7 @@ public class Gun extends StrikeItem
_loadedAmmo = _gunStats.getClipSize(); _loadedAmmo = _gunStats.getClipSize();
_reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize(); _reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize();
updateWeaponName(player); //updateWeaponName(player);
} }
public double getDamage() public double getDamage()

View File

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