Merge branch 'thanos-bug-fixes'

This commit is contained in:
Cheese 2015-10-16 12:53:43 +11:00
commit 6cc33fd6c6
6 changed files with 79 additions and 16 deletions

View File

@ -14,7 +14,11 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -40,6 +44,7 @@ public class ItemTNT extends ItemGadget
public void ActivateCustom(Player player) public void ActivateCustom(Player player)
{ {
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
tnt.setYield(0.0F); // Added in order to prevent water from being evaporated.
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false); UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false);
_tnt.add(tnt); _tnt.add(tnt);
@ -58,7 +63,7 @@ public class ItemTNT extends ItemGadget
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 10); HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 10);
for (Player player : players.keySet()) for (Player player : players.keySet())
{ {
if (Manager.collideEvent(this, player)) if (Manager.collideEvent(this, player))
continue; continue;
@ -67,6 +72,9 @@ public class ItemTNT extends ItemGadget
//Knockback //Knockback
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true); UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true);
} }
// Simulating explosion to prevent water from being evaporated.
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, event.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
} }

View File

@ -10,11 +10,11 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
@ -277,7 +277,7 @@ public class MineStrike extends TeamGame
//"Tap Crouch when close to an ally to Boost", //"Tap Crouch when close to an ally to Boost",
"Open Inventory at spawn to buy guns", "Open Inventory at spawn to buy guns",
"Hold Right-Click to Plant Bomb", "Hold Right-Click to Plant Bomb",
"Look at the Bomb to Defuse Bomb", "Look at the Bomb to Defuse it",
"Moving decreases accuracy", "Moving decreases accuracy",
"Sprinting heavily decreases accuracy", "Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy", "Jumping massively decreases accuracy",
@ -716,6 +716,7 @@ public class MineStrike extends TeamGame
return; return;
Grenade grenade = getGrenadeInHand(event.getPlayer(), null); Grenade grenade = getGrenadeInHand(event.getPlayer(), null);
if (grenade == null) if (grenade == null)
return; return;
@ -1519,9 +1520,25 @@ public class MineStrike extends TeamGame
if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD)) if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD))
return; return;
// Fixed bomb able to be planted after the round is over.
if (_roundOver)
{
UtilPlayer.message(player, F.main("Game", "You cannot plant the bomb once the round is over."));
event.setCancelled(true);
return;
}
// Added a small tip for players that are trying to right-click with the bomb.
if (UtilEvent.isAction(event, ActionType.L))
{
UtilPlayer.message(player, F.main("Game", "You must " + F.elem("Right-Click") + " while holding the bomb to plant it."));
event.setCancelled(true);
return;
}
if (!UtilEnt.isGrounded(player)) if (!UtilEnt.isGrounded(player))
{ {
UtilPlayer.message(player, F.main("Game", "You can only plant Bomb on the ground!")); UtilPlayer.message(player, F.main("Game", "You can only plant the bomb on the ground."));
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1529,7 +1546,7 @@ public class MineStrike extends TeamGame
//Should never occur with 1 Bomb //Should never occur with 1 Bomb
if (_bombPlanter != null) if (_bombPlanter != null)
{ {
UtilPlayer.message(player, F.main("Game", "Someone else is planting Bomb...")); UtilPlayer.message(player, F.main("Game", "Someone else is planting the bomb."));
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1548,7 +1565,7 @@ public class MineStrike extends TeamGame
//Too Far //Too Far
if (!near) if (!near)
{ {
UtilPlayer.message(player, F.main("Game", "You can only plant Bomb at a bomb site!")); UtilPlayer.message(player, F.main("Game", "You can only plant the bomb at a bomb site."));
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1556,7 +1573,7 @@ public class MineStrike extends TeamGame
_bombPlanter = player; _bombPlanter = player;
_bombPlanter.setExp(0f); _bombPlanter.setExp(0f);
UtilPlayer.message(player, F.main("Game", "You are placing the Bomb.")); UtilPlayer.message(player, F.main("Game", "You are now placing the bomb."));
//Radio //Radio
playSound(Radio.T_BOMB_PLANT, null, GetTeam(_bombPlanter)); playSound(Radio.T_BOMB_PLANT, null, GetTeam(_bombPlanter));
@ -1568,6 +1585,10 @@ public class MineStrike extends TeamGame
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
// Added to check if the round is over when a bomb is being planted.
if (_roundOver)
return;
if (_bombPlanter == null) if (_bombPlanter == null)
return; return;
@ -1937,6 +1958,7 @@ public class MineStrike extends TeamGame
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
removeScope(player);
Recharge.Instance.Reset(player, "reload"); Recharge.Instance.Reset(player, "reload");
} }
@ -2838,4 +2860,28 @@ public class MineStrike extends TeamGame
{ {
return _freezeTime > 0; return _freezeTime > 0;
} }
@EventHandler
public void cancelFireExtinguish(PlayerInteractEvent event)
{
// This is an extra event added in order to prevent players from
// extinguishing fire that gets generated from moltovs and incendiary grenades.
if (!IsLive())
return;
if (UtilEvent.isAction(event, ActionType.L_BLOCK))
{
Block block = event.getClickedBlock();
for (BlockFace face : BlockFace.values())
{
if (block.getRelative(face).getType() == Material.FIRE)
{
event.setCancelled(true);
return;
}
}
}
}
} }

View File

@ -23,6 +23,7 @@ import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats; import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats;
import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun; import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -46,7 +47,7 @@ public class ShopManager
} }
public void enterShop(Player player) public void enterShop(Player player)
{ {
GameTeam team = Host.GetTeam(player); GameTeam team = Host.GetTeam(player);
if (team == null) if (team == null)
return; return;
@ -101,14 +102,13 @@ public class ShopManager
public void addItem(StrikeItem item, Player player, int slot) public void addItem(StrikeItem item, Player player, int slot)
{ {
player.getInventory().setItem(slot, item.getShopItem(getMoney(player), hasItem(player, item))); player.getInventory().setItem(slot, item.getShopItem(getMoney(player), hasItem(player, item)));
_shop.get(player).put(slot, item); _shop.get(player).put(slot, item);
} }
public boolean hasItem(Player player, StrikeItem item) public boolean hasItem(Player player, StrikeItem item)
{ {
int count = 0; int count = 0;
for (int i=0 ; i<9 ; i++) for (int i=0 ; i<9 ; i++)
{ {
if (UtilGear.isMat(player.getInventory().getItem(i), item.getSkin())) if (UtilGear.isMat(player.getInventory().getItem(i), item.getSkin()))
@ -286,7 +286,7 @@ public class ShopManager
} }
public void update() public void update()
{ {
for (Player player : Host.GetPlayers(false)) for (Player player : Host.GetPlayers(false))
{ {
GameTeam team = Host.GetTeam(player); GameTeam team = Host.GetTeam(player);

View File

@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap; import java.util.HashMap;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
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.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -12,6 +11,7 @@ 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;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -39,7 +39,10 @@ public abstract class FireGrenadeBase extends Grenade
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) public boolean updateCustom(MineStrike game, Entity ent)
{ {
if (UtilEnt.isGrounded(ent)) // Fixed grenade effect not being activated when thrown in the ground.
// Looks like ent.isOnGround() worked, while we previously used UtilEnt.isGrounded(ent).
if (ent.isOnGround())
{ {
createFire(game, ent.getLocation()); createFire(game, ent.getLocation());
@ -76,7 +79,10 @@ public abstract class FireGrenadeBase extends Grenade
public void run() public void run()
{ {
if (round == game.getRound() && !game.isFreezeTime()) if (round == game.getRound() && !game.isFreezeTime())
game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) (_baseTime + blocks.get(block) * _baseTime)); {
double time = _baseTime + blocks.get(block) * _baseTime;
game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) time);
}
} }
}, 60 - (int)(60d * blocks.get(block))); }, 60 - (int)(60d * blocks.get(block)));
} }

View File

@ -130,7 +130,7 @@ public abstract class Grenade extends StrikeItem
} }
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game) public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
{ {
player.setItemInHand(null); player.setItemInHand(null);
_thrower = player; _thrower = player;

View File

@ -15,9 +15,12 @@ import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlockText; import mineplex.core.common.util.UtilBlockText;
import mineplex.core.common.util.UtilBlockText.TextAlign; import mineplex.core.common.util.UtilBlockText.TextAlign;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -1298,7 +1301,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
if (Manager.GetGame().GetState() == GameState.Live) if (Manager.GetGame().GetState() == GameState.Live)
return; return;
event.blockList().clear(); event.blockList().clear();
} }