Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-03-13 17:56:16 -07:00
commit de1365b5cf
22 changed files with 262 additions and 116 deletions

View File

@ -12,7 +12,7 @@ public class MessageCommand extends CommandBase<MessageManager>
{ {
public MessageCommand(MessageManager plugin) public MessageCommand(MessageManager plugin)
{ {
super(plugin, Rank.ALL, "m","msg","message","tell","t","w","whisper"); super(plugin, Rank.ALL, "m","msg","message","tell","t","w","whisper","MSG");
} }
@Override @Override

View File

@ -486,6 +486,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
((CraftEntity)player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); ((CraftEntity)player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
player.setSprinting(false);
player.setFoodLevel(20); player.setFoodLevel(20);
player.setSaturation(3f); player.setSaturation(3f);
player.setExhaustion(0f); player.setExhaustion(0f);

View File

@ -71,12 +71,12 @@ public abstract class Game implements Listener
//State //State
private GameState _gameState = GameState.Loading; private GameState _gameState = GameState.Loading;
private long _gameStateTime = System.currentTimeMillis(); private long _gameStateTime = System.currentTimeMillis();
private boolean _prepareCountdown = false;
private int _countdown = -1; private int _countdown = -1;
private boolean _countdownForce = false; private boolean _countdownForce = false;
private int _playerCount = 0;
private String _customWinLine = ""; private String _customWinLine = "";
//Kits //Kits
@ -274,16 +274,6 @@ public abstract class Game implements Listener
_countdownForce = value; _countdownForce = value;
} }
public int GetPlayerCountAtStart()
{
return _playerCount;
}
public void SetPlayerCountAtStart(int count)
{
_playerCount = count;
}
public NautHashMap<GameTeam, ArrayList<Player>> GetTeamPreferences() public NautHashMap<GameTeam, ArrayList<Player>> GetTeamPreferences()
{ {
return _teamPreference; return _teamPreference;
@ -561,7 +551,7 @@ public abstract class Game implements Listener
} }
_playerKit.put(player, kit); _playerKit.put(player, kit);
kit.Selected(player); kit.Selected(player);
if (announce) if (announce)
@ -569,7 +559,7 @@ public abstract class Game implements Listener
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
} }
if (InProgress()) if (InProgress())
kit.ApplyKit(player); kit.ApplyKit(player);
} }
@ -858,32 +848,35 @@ public abstract class Game implements Listener
public void AnnounceGame() public void AnnounceGame()
{ {
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ AnnounceGame(player);
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
for (int i=0 ; i<6-GetDesc().length ; i++)
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, C.cGreen + "Game - " + C.cYellow+ C.Bold + this.GetName());
UtilPlayer.message(player, "");
for (String line : this.GetDesc())
{
UtilPlayer.message(player, C.cWhite + "- " + line);
}
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGreen + "Map - " + C.cYellow + C.Bold + WorldData.MapName + ChatColor.RESET + C.cGray + " created by " + C.cYellow+ C.Bold + WorldData.MapAuthor);
UtilPlayer.message(player, ArcadeFormat.Line);
}
if (AnnounceSilence) if (AnnounceSilence)
Manager.GetChat().Silence(9000, false); Manager.GetChat().Silence(9000, false);
} }
public void AnnounceGame(Player player)
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
for (int i=0 ; i<6-GetDesc().length ; i++)
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, C.cGreen + "Game - " + C.cYellow+ C.Bold + this.GetName());
UtilPlayer.message(player, "");
for (String line : this.GetDesc())
{
UtilPlayer.message(player, C.cWhite + "- " + line);
}
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGreen + "Map - " + C.cYellow + C.Bold + WorldData.MapName + ChatColor.RESET + C.cGray + " created by " + C.cYellow+ C.Bold + WorldData.MapAuthor);
UtilPlayer.message(player, ArcadeFormat.Line);
}
public void AnnounceEnd(GameTeam team) public void AnnounceEnd(GameTeam team)
{ {
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -1019,4 +1012,14 @@ public abstract class Game implements Listener
_helpIndex = (_helpIndex + 1)%_help.length; _helpIndex = (_helpIndex + 1)%_help.length;
} }
public void StartPrepareCountdown()
{
_prepareCountdown = true;
}
public boolean CanStartPrepareCountdown()
{
return _prepareCountdown;
}
} }

View File

@ -57,9 +57,9 @@ public class GameTeam
private Creature _teamEntity = null; private Creature _teamEntity = null;
private HashSet<Kit> _kitRestrict = new HashSet<Kit>(); private HashSet<Kit> _kitRestrict = new HashSet<Kit>();
private int _spawnDistance = 0; private int _spawnDistance = 0;
private boolean _visible = true; private boolean _visible = true;
public GameTeam(String name, ChatColor color, ArrayList<Location> spawns) public GameTeam(String name, ChatColor color, ArrayList<Location> spawns)
@ -87,40 +87,40 @@ public class GameTeam
public Location GetSpawn() public Location GetSpawn()
{ {
ArrayList<Location> valid = new ArrayList<Location>(); ArrayList<Location> valid = new ArrayList<Location>();
Location best = null; Location best = null;
double bestDist = 0; double bestDist = 0;
for (Location loc : _spawns) for (Location loc : _spawns)
{ {
double closestPlayer = -1; double closestPlayer = -1;
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
double playerDist = UtilMath.offset(player.getLocation(), loc); double playerDist = UtilMath.offset(player.getLocation(), loc);
if (closestPlayer == -1 || playerDist < closestPlayer) if (closestPlayer == -1 || playerDist < closestPlayer)
closestPlayer = playerDist; closestPlayer = playerDist;
} }
if (best == null || closestPlayer > bestDist) if (best == null || closestPlayer > bestDist)
{ {
best = loc; best = loc;
bestDist = closestPlayer; bestDist = closestPlayer;
} }
if (closestPlayer > _spawnDistance) if (closestPlayer > _spawnDistance)
{ {
valid.add(loc); valid.add(loc);
} }
} }
if (valid.size() > 0) if (valid.size() > 0)
valid.get(UtilMath.r(valid.size())); valid.get(UtilMath.r(valid.size()));
if (best != null) if (best != null)
return best; return best;
return _spawns.get(UtilMath.r(_spawns.size())); return _spawns.get(UtilMath.r(_spawns.size()));
} }
@ -150,22 +150,22 @@ public class GameTeam
for (Player player : _players.keySet()) for (Player player : _players.keySet())
if (player.getName().equals(name)) if (player.getName().equals(name))
return player; return player;
return null; return null;
} }
public boolean HasPlayer(Player player) public boolean HasPlayer(Player player)
{ {
return _players.containsKey(player); return _players.containsKey(player);
} }
public boolean HasPlayer(String name, boolean alive) public boolean HasPlayer(String name, boolean alive)
{ {
for (Player player : _players.keySet()) for (Player player : _players.keySet())
if (player.getName().equals(name)) if (player.getName().equals(name))
if (!alive || (alive && _players.get(player) == PlayerState.IN)) if (!alive || (alive && _players.get(player) == PlayerState.IN))
return true; return true;
return false; return false;
} }
@ -178,7 +178,7 @@ public class GameTeam
{ {
if (player == null) if (player == null)
return; return;
_players.put(player, state); _players.put(player, state);
} }
@ -207,13 +207,18 @@ public class GameTeam
return GetColor() + "§l" + GetName(); return GetColor() + "§l" + GetName();
} }
public void SpawnTeleport(Player player)
{
player.leaveVehicle();
player.eject();
player.teleport(GetSpawn());
}
public void SpawnTeleport() public void SpawnTeleport()
{ {
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
player.leaveVehicle(); SpawnTeleport(player);
player.eject();
player.teleport(GetSpawn());
} }
} }
@ -226,7 +231,7 @@ public class GameTeam
{ {
if (kit.GetAvailability() == KitAvailability.Null) if (kit.GetAvailability() == KitAvailability.Null)
return false; return false;
return !_kitRestrict.contains(kit); return !_kitRestrict.contains(kit);
} }
@ -268,7 +273,7 @@ public class GameTeam
if (GetColor() == ChatColor.RED) return (byte)14; if (GetColor() == ChatColor.RED) return (byte)14;
else return (byte)15; else return (byte)15;
} }
public Color GetColorBase() public Color GetColorBase()
{ {
if (GetColor() == ChatColor.WHITE) return Color.WHITE; if (GetColor() == ChatColor.WHITE) return Color.WHITE;
@ -302,7 +307,7 @@ public class GameTeam
{ {
_spawns = spawns; _spawns = spawns;
} }
public void SetSpawnRequirement(int value) public void SetSpawnRequirement(int value)
{ {
_spawnDistance = value; _spawnDistance = value;
@ -312,7 +317,7 @@ public class GameTeam
{ {
_visible = b; _visible = b;
} }
public boolean GetVisible() public boolean GetVisible()
{ {
return _visible; return _visible;

View File

@ -755,6 +755,9 @@ public class HideSeek extends TeamGame
if (!UtilGear.isMat(player.getItemInHand(), Material.FIREWORK)) if (!UtilGear.isMat(player.getItemInHand(), Material.FIREWORK))
return; return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!Recharge.Instance.use(player, "Firework", 15000, true)) if (!Recharge.Instance.use(player, "Firework", 15000, true))
{ {

View File

@ -1284,8 +1284,14 @@ public class HungerGames extends SoloGame
{ {
if (!event.getMessage().equalsIgnoreCase("/dm")) if (!event.getMessage().equalsIgnoreCase("/dm"))
return; return;
event.setCancelled(true); event.setCancelled(true);
if (!IsAlive(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are not in the game."));
return;
}
if (!IsLive()) if (!IsLive())
{ {

View File

@ -25,6 +25,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
@ -74,6 +75,8 @@ public class Paintball extends TeamGame
"Revive/heal with Water Bombs", "Revive/heal with Water Bombs",
"Last team alive wins!" "Last team alive wins!"
}); });
this.HungerSet = 20;
} }
@EventHandler @EventHandler
@ -430,4 +433,11 @@ public class Paintball extends TeamGame
stack.setItemMeta(meta); stack.setItemMeta(meta);
} }
} }
@EventHandler
public void InventoryClick(InventoryClickEvent event)
{
event.setCancelled(true);
event.getWhoClicked().closeInventory();
}
} }

View File

@ -27,6 +27,8 @@ public class PlayerCopy
_ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class);
Host.CreatureAllowOverride = false; Host.CreatureAllowOverride = false;
UtilEnt.ghost(_ent, true, false);
UtilEnt.Vegetate(_ent); UtilEnt.Vegetate(_ent);
//Armor //Armor

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -41,6 +43,18 @@ public class KitBrawler extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live) if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
} }
} }

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -41,6 +43,18 @@ public class KitElementalist extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live) if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
} }
} }

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -41,6 +43,18 @@ public class KitLeaper extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live) if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
} }
} }

View File

@ -101,7 +101,7 @@ public class SheepGame extends TeamGame
"Return Sheep to your Team Pen!", "Return Sheep to your Team Pen!",
"Most sheep at 5 minutes wins!" "Most sheep at 5 minutes wins!"
}); });
this.DeathOut = false; this.DeathOut = false;
this.DeathSpectateSecs = 8; this.DeathSpectateSecs = 8;

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -44,5 +46,17 @@ public class KitInfiltrator extends Kit
amount = 48; amount = 48;
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
//Update
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
} }
} }

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -19,17 +21,17 @@ public class KitMarksman extends Kit
{ {
super(manager, "Marksman", KitAvailability.Free, super(manager, "Marksman", KitAvailability.Free,
new String[] new String[]
{ {
"Unrivaled in archery. One hit kills anyone." "Unrivaled in archery. One hit kills anyone."
}, },
new Perk[] new Perk[]
{ {
new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false), new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false),
new PerkFletcher(2, 2, false), new PerkFletcher(2, 2, false),
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
new ItemStack(Material.BOW)); new ItemStack(Material.BOW));
} }
@ -37,11 +39,22 @@ public class KitMarksman extends Kit
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
int amount = 4; int amount = 4;
if (!Manager.GetGame().IsLive()) if (!Manager.GetGame().IsLive())
amount = 48; amount = 48;
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
//Update
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
} }
} }

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -20,29 +22,40 @@ public class KitShredder extends Kit
{ {
super(manager, "Shredder", KitAvailability.Blue, super(manager, "Shredder", KitAvailability.Blue,
new String[] new String[]
{ {
"Arrows are weaker, but shred through forts." "Arrows are weaker, but shred through forts."
}, },
new Perk[] new Perk[]
{ {
new PerkConstructor("Constructor", 4, 6, Material.WOOL, "Wool", false), new PerkConstructor("Constructor", 4, 6, Material.WOOL, "Wool", false),
new PerkFletcher(4, 2, false), new PerkFletcher(4, 2, false),
new PerkBarrage(5, 250, false, false), new PerkBarrage(5, 250, false, false),
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
new ItemStack(Material.BOW)); new ItemStack(Material.BOW));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
int amount = 4; int amount = 4;
if (!Manager.GetGame().IsLive()) if (!Manager.GetGame().IsLive())
amount = 48; amount = 48;
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
//Update
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
} }
} }

View File

@ -101,6 +101,8 @@ public abstract class Kit implements Listener
perk.Apply(player); perk.Apply(player);
GiveItems(player); GiveItems(player);
UtilInv.Update(player);
} }
public abstract void GiveItems(Player player); public abstract void GiveItems(Player player);

View File

@ -57,7 +57,7 @@ public class PerkAxeThrower extends Perk implements IThrown
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(player.getItemInHand().getType())); org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(player.getItemInHand().getType()));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d); Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
//Remove Axe //Remove Axe
player.setItemInHand(null); player.setItemInHand(null);

View File

@ -56,7 +56,7 @@ public class PerkBarrage extends Perk
@EventHandler @EventHandler
public void BarrageDrawBow(PlayerInteractEvent event) public void BarrageDrawBow(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)

View File

@ -110,6 +110,9 @@ public class PerkDisruptor extends Perk
event.setCancelled(true); event.setCancelled(true);
if (!Manager.GetGame().IsAlive(event.getPlayer()))
return;
if (event.getItem().getTicksLived() < 40) if (event.getItem().getTicksLived() < 40)
return; return;

View File

@ -60,6 +60,11 @@ public class PerkPigZombie extends Perk
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
player.getInventory().remove(Material.DIAMOND_HELMET);
player.getInventory().remove(Material.DIAMOND_CHESTPLATE);
player.getInventory().remove(Material.DIAMOND_LEGGINGS);
player.getInventory().remove(Material.DIAMOND_BOOTS);
//Disguise //Disguise
DisguisePig disguise = new DisguisePig(player); DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cYellow + player.getName()); disguise.SetName(C.cYellow + player.getName());

View File

@ -37,6 +37,9 @@ public class PerkTNTArrow extends Perk
@EventHandler @EventHandler
public void Fire(PlayerInteractEvent event) public void Fire(PlayerInteractEvent event)
{ {
if (!Manager.GetGame().IsLive())
return;
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
return; return;

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.managers; package nautilus.game.arcade.managers;
import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -119,26 +120,29 @@ public class GameManager implements Listener
} }
else if (game.GetState() == GameState.Prepare) else if (game.GetState() == GameState.Prepare)
{ {
if (UtilTime.elapsed(game.GetStateTime(), 9000)) if (game.CanStartPrepareCountdown())
{ {
for (Player player : UtilServer.getPlayers()) if (UtilTime.elapsed(game.GetStateTime(), 9000))
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f);
if (game.GetPlayers(true).size() < 2)
{ {
game.Announce(C.cWhite + C.Bold + game.GetName() + " ended, not enough players!"); for (Player player : UtilServer.getPlayers())
game.SetState(GameState.Dead); player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f);
if (game.GetPlayers(true).size() < 2)
{
game.Announce(C.cWhite + C.Bold + game.GetName() + " ended, not enough players!");
game.SetState(GameState.Dead);
}
else
{
game.SetState(GameState.Live);
}
} }
else else
{ {
game.SetState(GameState.Live); for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f);
} }
} }
else
{
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f);
}
} }
else if (game.GetState() == GameState.Live) else if (game.GetState() == GameState.Live)
{ {
@ -466,32 +470,48 @@ public class GameManager implements Listener
@EventHandler @EventHandler
public void PlayerPrepare(GameStateChangeEvent event) public void PlayerPrepare(GameStateChangeEvent event)
{ {
Game game = event.GetGame(); final Game game = event.GetGame();
if (event.GetState() != GameState.Prepare) if (event.GetState() != GameState.Prepare)
return; return;
//Teleport final ArrayList<Player> players = game.GetPlayers(true);
for (GameTeam team : game.GetTeamList())
team.SpawnTeleport();
//Save Initial Player Count
game.SetPlayerCountAtStart(game.GetPlayers(true).size());
//Announce
game.AnnounceGame();
//Prepare Players //Prepare Players
for (Player player : game.GetPlayers(true)) for (int i=0 ; i<players.size() ; i++)
{ {
Manager.Clear(player); final Player player = players.get(i);
UtilInv.Clear(player);
final GameTeam team = game.GetTeam(player);
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
public void run()
{
//Teleport
if (team != null)
team.SpawnTeleport(player);
Manager.Clear(player);
UtilInv.Clear(player);
game.ValidateKit(player, game.GetTeam(player)); game.ValidateKit(player, game.GetTeam(player));
if (game.GetKit(player) != null) if (game.GetKit(player) != null)
game.GetKit(player).ApplyKit(player); game.GetKit(player).ApplyKit(player);
}
}, i);
} }
//Announce Game after every player is TP'd in
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
public void run()
{
game.AnnounceGame();
game.StartPrepareCountdown();
}
}, players.size());
} }
@EventHandler @EventHandler