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

This commit is contained in:
Jonathan Williams 2014-03-29 01:33:18 -04:00
commit 195e555a6e
23 changed files with 542 additions and 225 deletions

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
public enum Rank public enum Rank
{ {
OWNER("OP", ChatColor.DARK_RED), OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED), DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED), ADMIN("Admin", ChatColor.RED),
MODERATOR("Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD),

View File

@ -71,6 +71,12 @@ public class F
{ {
return C.mSkill + elem + C.mBody; return C.mSkill + elem + C.mBody;
} }
public static String skill(String a, String b)
{
return C.cYellow + " " + C.cGreen + b + C.mBody;
}
public static String time(String elem) public static String time(String elem)
{ {

View File

@ -1,6 +1,8 @@
package mineplex.core.shop.item; package mineplex.core.shop.item;
import java.util.ArrayList;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
@ -22,7 +23,9 @@ public class BackStab extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Attacks from behind opponents", "Attacks from behind opponents",
"deals 4 additional damage." "deals 2 additional damage.",
"",
C.cGold + "+1 damage per Level"
}); });
} }

View File

@ -54,15 +54,15 @@ public class FleshHook extends SkillActive implements IThrown
"Release Block to release it.", "Release Block to release it.",
"", "",
"If Flesh Hook hits a player, it", "If Flesh Hook hits a player, it",
"deals up to 12 damage, and rips them", "deals up to #2#2 damage, and rips them",
"towards you with high velocity.", "towards you with #1.2#0.2 velocity.",
}); });
} }
@Override @Override
public String GetEnergyString() public String GetEnergyString()
{ {
return "Energy: 20 + (5 per 20% Strength)"; return null;
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill; package mineplex.minecraft.game.classcombat.Skill;
import java.util.ArrayList;
import java.util.Set; import java.util.Set;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -26,7 +27,7 @@ public interface ISkill
SkillType GetSkillType(); SkillType GetSkillType();
int GetCost(); int GetCost();
boolean IsFree(); boolean IsFree();
String[] GetDesc(); String[] GetDesc(int level);
void Reset(Player player); void Reset(Player player);
Set<Player> GetUsers(); Set<Player> GetUsers();

View File

@ -1,8 +1,10 @@
package mineplex.minecraft.game.classcombat.Skill; package mineplex.minecraft.game.classcombat.Skill;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set; import java.util.Set;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
@ -19,7 +21,7 @@ public abstract class Skill implements ISkill, Listener
//Properties //Properties
private String _name; private String _name;
private String[] _desc; private String[] _desc;
private String[] _descFull; private HashMap<Integer, String[]> _descLevels = new HashMap<Integer, String[]>();
private ClassType _classType; private ClassType _classType;
private SkillType _skillType; private SkillType _skillType;
@ -107,36 +109,85 @@ public abstract class Skill implements ISkill, Listener
} }
@Override @Override
public String[] GetDesc() public String[] GetDesc(int curLevel)
{ {
if (_descFull != null) //Desc of this level has already been generated
return _descFull; if (_descLevels.containsKey(curLevel))
{
String recharge = GetRechargeString(); return _descLevels.get(curLevel);
String energy = GetEnergyString(); }
if (recharge == null && energy == null) //Generate DESC
_descFull = _desc;
ArrayList<String> descFull = new ArrayList<String>(); ArrayList<String> descOut = new ArrayList<String>();
//Parse Desc
for (String line : _desc) for (String line : _desc)
descFull.add(line); {
String newLine = "";
//Check for Level Tokens
for (String token : line.split(" "))
{
if (token.length() <= 0)
continue;
//Parse Level Token
if (token.charAt(0) == '#')
{
String[] numberToks = token.split("#");
try
{
double base = Double.parseDouble(numberToks[0]);
double bonus = Double.parseDouble(numberToks[1]);
double levelValue = base + ((double)curLevel * bonus);
char plusMinus = '+';
if (bonus < 0)
plusMinus = '-';
if (energy != null || recharge != null) token = C.cYellow + levelValue + C.cGray + " (" + C.cGreen + plusMinus + bonus + C.cGray + ")";
descFull.add(""); }
catch (Exception e)
{
token = C.cRed + token + C.cGray;
break;
}
}
newLine += token + " ";
}
//Remove Space
if (newLine.length() > 0)
newLine = newLine.substring(0, newLine.length()-1);
descOut.add(newLine);
}
//Append Energy & Recharge
if (GetEnergyString() != null || GetRechargeString() != null)
descOut.add("");
if (energy != null) if (GetEnergyString() != null)
descFull.add(energy); descOut.add(GetEnergyString());
if (recharge != null) if (GetRechargeString() != null)
descFull.add(recharge); descOut.add(GetRechargeString());
_descFull = new String[descFull.size()]; //Return
for (int i=0 ; i<descFull.size() ; i++) String[] out = new String[descOut.size()];
_descFull[i] = descFull.get(i);
for (int i=0 ; i<descOut.size() ; i++)
return _descFull; out[i] = descOut.get(i);
//Store
_descLevels.put(curLevel, out);
return out;
} }
public String GetEnergyString() public String GetEnergyString()

View File

@ -137,7 +137,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
skillLore.add(C.cBlack); skillLore.add(C.cBlack);
} }
skillLore.addAll(Arrays.asList(skill.GetDesc())); skillLore.addAll(java.util.Arrays.asList(skill.GetDesc(0)));
for (int i = 0; i < skillLore.size(); i++) for (int i = 0; i < skillLore.size(); i++)
{ {

View File

@ -11,7 +11,7 @@ public class SkillSalesPackage extends SalesPackageBase
{ {
public SkillSalesPackage(ISkill skill) public SkillSalesPackage(ISkill skill)
{ {
super(skill.GetName(), Material.BOOK, skill.GetDesc()); super(skill.GetName(), Material.BOOK, skill.GetDesc(0));
SalesPackageId = skill.GetSalesPackageId(); SalesPackageId = skill.GetSalesPackageId();
Free = skill.IsFree(); Free = skill.IsFree();
} }

View File

@ -1,61 +0,0 @@
package nautilus.game.arcade.game;
import java.util.HashMap;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.kit.Kit;
public abstract class AsymTeamGame extends TeamGame
{
private HashMap<String, ChatColor> _pastTeams = null;
public AsymTeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc, HashMap<String, ChatColor> pastTeams)
{
super(manager, gameType, kits, gameDesc);
_pastTeams = pastTeams;
}
public HashMap<String, ChatColor> GetPastTeams()
{
return _pastTeams;
}
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
if (GetPastTeams() != null)
{
this.SetCountdown(30);
this.SetCountdownForce(true);
}
}
@Override
public GameTeam ChooseTeam(Player player)
{
//Get Past Team
ChatColor pastTeam = null;
if (_pastTeams != null)
pastTeam = _pastTeams.get(player.getName());
GameTeam newTeam = null;
for (int i=0 ; i<GetTeamList().size() ; i++)
if (newTeam == null || GetTeamList().get(i).GetSize() < newTeam.GetSize())
if (pastTeam == null || GetTeamList().get(i).GetColor() != pastTeam)
newTeam = GetTeamList().get(i);
return newTeam;
}
}

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import org.bukkit.Bukkit; 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.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -50,7 +51,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -66,27 +66,28 @@ public class CastleSiege extends TeamGame
private ArrayList<Location> _tntSpawns = new ArrayList<Location>(); private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
private ArrayList<Location> _tntWeakness = new ArrayList<Location>(); private ArrayList<Location> _tntWeakness = new ArrayList<Location>();
private HashMap<Player, FallingBlock> _tntCarry = new HashMap<Player, FallingBlock>(); private HashMap<Player, FallingBlock> _tntCarry = new HashMap<Player, FallingBlock>();
private ArrayList<Location> _kingLocs; private ArrayList<Location> _kingLocs;
private Creature _king; private Creature _king;
private Location _kingLoc; private Location _kingLoc;
private String _kingName; private String _kingName;
private Player _kingDamager = null; private Player _kingDamager = null;
private int _kingHealth = 30; private int _kingHealth = 40;
private ArrayList<Location> _peasantSpawns; private ArrayList<Location> _peasantSpawns;
private ArrayList<Location> _horseSpawns; private ArrayList<Location> _horseSpawns;
public CastleSiege(ArcadeManager manager) public CastleSiege(ArcadeManager manager)
{ {
super(manager, GameType.CastleSiege, super(manager, GameType.CastleSiege,
new Kit[] new Kit[]
{ {
new KitHumanKnight(manager),
new KitHumanMarksman(manager), new KitHumanMarksman(manager),
new KitHumanBrawler(manager), new KitHumanKnight(manager),
//new KitHumanBrawler(manager),
//new KitHumanAssassin(manager),
new NullKit(manager),
new KitHumanPeasant(manager), new KitHumanPeasant(manager),
new NullKit(manager), new NullKit(manager),
new KitUndeadGhoul(manager), new KitUndeadGhoul(manager),
@ -98,18 +99,30 @@ public class CastleSiege extends TeamGame
{ {
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.", F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.", F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.", F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
"", "",
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.", F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.", F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
}); });
_help = new String[]
{
"Marksmen are extremely important to defence!",
"It's recommended 50%+ of defence are Marksmen.",
"Use Barricades to block the Undeads path.",
"Use TNT to destroy weak points in walls.",
"Weak points are marked by cracked stone brick.",
"Undead can break fences with their axes.",
"Undead Archers must pick up arrows from the ground.",
};
this.HungerSet = 20; this.HungerSet = 20;
this.DeathOut = false; this.DeathOut = false;
this.WorldTimeSet = 14000; //14000 this.WorldTimeSet = 14000; //14000
this.BlockPlaceAllow.add(85); this.BlockPlaceAllow.add(85);
_kingName = C.cYellow + C.Bold + "King Jonalon"; _kingName = C.cYellow + C.Bold + "King Jonalon";
} }
@ -141,13 +154,13 @@ public class CastleSiege extends TeamGame
{ {
if (kit.GetName().contains("Undead")) if (kit.GetName().contains("Undead"))
team.GetRestrictedKits().add(kit); team.GetRestrictedKits().add(kit);
team.SetRespawnTime(8); team.SetRespawnTime(8);
} }
} }
} }
} }
@EventHandler @EventHandler
public void MoveKits(GameStateChangeEvent event) public void MoveKits(GameStateChangeEvent event)
{ {
@ -162,25 +175,25 @@ public class CastleSiege extends TeamGame
this.CreatureAllowOverride = true; this.CreatureAllowOverride = true;
Entity ent = GetKits()[5+i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); Entity ent = GetKits()[5+i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
this.CreatureAllowOverride = false; this.CreatureAllowOverride = false;
Manager.GetCondition().Factory().Invulnerable("Kit", (LivingEntity)ent, (LivingEntity)ent, 999999, false, false); Manager.GetCondition().Factory().Invulnerable("Kit", (LivingEntity)ent, (LivingEntity)ent, 999999, false, false);
Manager.GetLobby().AddKitLocation(ent, GetKits()[5+i], WorldData.GetDataLocs("PINK").get(i)); Manager.GetLobby().AddKitLocation(ent, GetKits()[5+i], WorldData.GetDataLocs("PINK").get(i));
} }
} }
@EventHandler @EventHandler
public void HorseSpawn(GameStateChangeEvent event) public void HorseSpawn(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Prepare) if (event.GetState() != GameState.Prepare)
return; return;
for (Location loc : _horseSpawns) for (Location loc : _horseSpawns)
{ {
this.CreatureAllowOverride = true; this.CreatureAllowOverride = true;
Horse horse = loc.getWorld().spawn(loc, Horse.class); Horse horse = loc.getWorld().spawn(loc, Horse.class);
this.CreatureAllowOverride = false; this.CreatureAllowOverride = false;
horse.setAdult(); horse.setAdult();
horse.setAgeLock(true); horse.setAgeLock(true);
horse.setColor(org.bukkit.entity.Horse.Color.BLACK); horse.setColor(org.bukkit.entity.Horse.Color.BLACK);
@ -189,14 +202,14 @@ public class CastleSiege extends TeamGame
horse.setMaxDomestication(1); horse.setMaxDomestication(1);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
horse.setMaxHealth(60); horse.setMaxHealth(60);
horse.setHealth(horse.getMaxHealth()); horse.setHealth(horse.getMaxHealth());
horse.setCustomName("War Horse"); horse.setCustomName("War Horse");
} }
} }
@EventHandler @EventHandler
public void HorseInteract(PlayerInteractEntityEvent event) public void HorseInteract(PlayerInteractEntityEvent event)
{ {
@ -205,19 +218,41 @@ public class CastleSiege extends TeamGame
Player player = event.getPlayer(); Player player = event.getPlayer();
GameTeam team = GetTeam(player); GameTeam team = GetTeam(player);
if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player)) if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler
public void HorseDamageCancel(CustomDamageEvent event)
{
if (!(event.GetDamageeEntity() instanceof Horse))
return;
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (!IsAlive(player))
return;
if (GetTeam(player) == null)
return;
if (GetTeam(player).GetColor() == ChatColor.RED)
return;
event.SetCancelled("Horse Team Damage");
}
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event) public void GameStateChange(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Prepare) if (event.GetState() != GameState.Prepare)
return; return;
//Spawn King //Spawn King
this.CreatureAllowOverride = true; this.CreatureAllowOverride = true;
@ -233,22 +268,22 @@ public class CastleSiege extends TeamGame
_king.setCustomName(_kingName); _king.setCustomName(_kingName);
_king.setCustomNameVisible(true); _king.setCustomNameVisible(true);
_king.setRemoveWhenFarAway(false); _king.setRemoveWhenFarAway(false);
this.CreatureAllowOverride = false; this.CreatureAllowOverride = false;
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void SetDefenderRespawn(GameStateChangeEvent event) public void SetDefenderRespawn(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Live) if (event.GetState() != GameState.Live)
return; return;
//Change to Peasant Spawns //Change to Peasant Spawns
this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns); this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns);
} }
@EventHandler @EventHandler
public void KingTarget(EntityTargetEvent event) public void KingTarget(EntityTargetEvent event)
@ -264,7 +299,7 @@ public class CastleSiege extends TeamGame
if (!event.GetDamageeEntity().equals(_king)) if (!event.GetDamageeEntity().equals(_king))
return; return;
event.SetCancelled("King Damage"); event.SetCancelled("King Damage");
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
@ -276,24 +311,24 @@ public class CastleSiege extends TeamGame
{ {
_kingDamager = damager; _kingDamager = damager;
_kingHealth--; _kingHealth--;
if (_kingHealth <= 0) if (_kingHealth <= 0)
_king.damage(500); _king.damage(500);
} }
} }
@EventHandler @EventHandler
public void KingUpdate(UpdateEvent event) public void KingUpdate(UpdateEvent event)
{ {
if (GetState() != GameState.Live) if (GetState() != GameState.Live)
return; return;
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
if (_king == null) if (_king == null)
return; return;
if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6) if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6)
{ {
_king.teleport(_kingLoc); _king.teleport(_kingLoc);
@ -323,21 +358,21 @@ public class CastleSiege extends TeamGame
{ {
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore(_kingHealth); GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore(_kingHealth);
} }
//Teams //Teams
HashMap<String, Integer> _scoreGroup = new HashMap<String, Integer>(); HashMap<String, Integer> _scoreGroup = new HashMap<String, Integer>();
_scoreGroup.put(C.cAqua + "Wolves", 0); _scoreGroup.put(C.cAqua + "Wolves", 0);
_scoreGroup.put(C.cAqua + "Defenders", 0); _scoreGroup.put(C.cAqua + "Defenders", 0);
_scoreGroup.put(C.cRed + "Undead", 0); _scoreGroup.put(C.cRed + "Undead", 0);
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
if (!IsAlive(player)) if (!IsAlive(player))
continue; continue;
Kit kit = GetKit(player); Kit kit = GetKit(player);
if (kit == null) continue; if (kit == null) continue;
if (kit.GetName().contains("Castle")) if (kit.GetName().contains("Castle"))
{ {
if (kit.GetName().contains("Wolf")) if (kit.GetName().contains("Wolf"))
@ -354,7 +389,7 @@ public class CastleSiege extends TeamGame
_scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead")); _scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead"));
} }
} }
for (String group : _scoreGroup.keySet()) for (String group : _scoreGroup.keySet())
{ {
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(group)).setScore(_scoreGroup.get(group)); GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(group)).setScore(_scoreGroup.get(group));
@ -366,11 +401,11 @@ public class CastleSiege extends TeamGame
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (this.WorldTimeSet > 24100) if (this.WorldTimeSet > 24100)
{ {
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!"); SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!");
SetState(GameState.End); SetState(GameState.End);
AnnounceEnd(GetTeam(ChatColor.AQUA)); AnnounceEnd(GetTeam(ChatColor.AQUA));
@ -399,7 +434,7 @@ public class CastleSiege extends TeamGame
} }
else else
SetCustomWinLine(_kingName + ChatColor.RESET + " has died!"); SetCustomWinLine(_kingName + ChatColor.RESET + " has died!");
SetState(GameState.End); SetState(GameState.End);
AnnounceEnd(GetTeam(ChatColor.RED)); AnnounceEnd(GetTeam(ChatColor.RED));
@ -425,13 +460,16 @@ public class CastleSiege extends TeamGame
{ {
if (GetState() != GameState.Live) if (GetState() != GameState.Live)
return; return;
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
if (!UtilTime.elapsed(this.GetStateTime(), 20000))
return;
if (!UtilTime.elapsed(_tntSpawn, 25000)) if (!UtilTime.elapsed(_tntSpawn, 25000))
return; return;
if (_tntSpawns.isEmpty()) if (_tntSpawns.isEmpty())
return; return;
@ -459,7 +497,7 @@ public class CastleSiege extends TeamGame
if (!IsAlive(player)) if (!IsAlive(player))
return; return;
if (!GetTeam(ChatColor.RED).HasPlayer(player)) if (!GetTeam(ChatColor.RED).HasPlayer(player))
return; return;
@ -494,7 +532,7 @@ public class CastleSiege extends TeamGame
return; return;
event.setCancelled(true); event.setCancelled(true);
for (Location loc : _tntSpawns) for (Location loc : _tntSpawns)
{ {
if (UtilMath.offset(player.getLocation(), loc) < 16) if (UtilMath.offset(player.getLocation(), loc) < 16)
@ -538,7 +576,7 @@ public class CastleSiege extends TeamGame
if (dist < 2) if (dist < 2)
{ {
int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d)); int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(), Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
@ -563,8 +601,8 @@ public class CastleSiege extends TeamGame
{ {
Player player = tntIterator.next(); Player player = tntIterator.next();
FallingBlock block = _tntCarry.get(player); FallingBlock block = _tntCarry.get(player);
if (player.isDead() || !block.isValid() || block.getTicksLived() > 600) if (player.isDead() || !block.isValid() || block.getTicksLived() > 900)
{ {
player.eject(); player.eject();
block.remove(); block.remove();
@ -588,7 +626,7 @@ public class CastleSiege extends TeamGame
} }
} }
} }
@EventHandler @EventHandler
public void TNTWeakness(ExplosionPrimeEvent event) public void TNTWeakness(ExplosionPrimeEvent event)
{ {
@ -601,14 +639,14 @@ public class CastleSiege extends TeamGame
break; break;
} }
} }
if (weakness == null) if (weakness == null)
return; return;
_tntWeakness.remove(weakness); _tntWeakness.remove(weakness);
final Location extra = weakness; final Location extra = weakness;
for (int i=0 ; i<10 ; i++) for (int i=0 ; i<10 ; i++)
{ {
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
@ -621,37 +659,37 @@ public class CastleSiege extends TeamGame
} }
}, i*3); }, i*3);
} }
weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f); weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event) public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
{ {
GameTeam team = GetTeam(event.getPlayer()); GameTeam team = GetTeam(event.getPlayer());
if (team == null) if (team == null)
return; return;
if (team.GetColor() != ChatColor.RED) if (team.GetColor() != ChatColor.RED)
return; return;
if (event.getBlock().getTypeId() == 85) if (event.getBlock().getTypeId() == 85)
event.setCancelled(false); event.setCancelled(false);
} }
@EventHandler @EventHandler
public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
{ {
GameTeam team = GetTeam(event.getPlayer()); GameTeam team = GetTeam(event.getPlayer());
if (team == null) if (team == null)
return; return;
if (team.GetColor() != ChatColor.AQUA) if (team.GetColor() != ChatColor.AQUA)
return; return;
if (event.getBlock().getTypeId() != 85) if (event.getBlock().getTypeId() != 85)
return; return;
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
{ {
if (block.isLiquid()) if (block.isLiquid())
@ -666,14 +704,14 @@ public class CastleSiege extends TeamGame
event.setCancelled(true); event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other.")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other."));
} }
if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4) if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4)
{ {
event.setCancelled(true); event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + ".")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + "."));
} }
} }
@EventHandler @EventHandler
public void DayTimer(UpdateEvent event) public void DayTimer(UpdateEvent event)
{ {
@ -682,13 +720,13 @@ public class CastleSiege extends TeamGame
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
WorldTimeSet = (WorldTimeSet+1); WorldTimeSet = (WorldTimeSet+1);
long timeLeft = 24000 - WorldTimeSet; long timeLeft = 24000 - WorldTimeSet;
timeLeft = timeLeft / 20 * 1000; timeLeft = timeLeft / 20 * 1000;
if (timeLeft > 0) if (timeLeft > 0)
GetObjectiveSide().setDisplayName( GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l" ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l"
@ -697,10 +735,31 @@ public class CastleSiege extends TeamGame
{ {
GetObjectiveSide().setDisplayName( GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun has risen!"); ChatColor.WHITE + "§lSun has risen!");
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true)) for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false); Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false);
} }
} }
@EventHandler
public void SnowDamage(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.FAST)
return;
for (Player player : GetPlayers(true))
if (player.getLocation().getBlock().getTypeId() == 78)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.DROWNING, 2, false, true, false,
"Snow", "Snow Damage");
player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80);
}
}
} }

View File

@ -0,0 +1,81 @@
package nautilus.game.arcade.game.games.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkLeap;
import nautilus.game.arcade.kit.perks.PerkPowershot;
import nautilus.game.arcade.kit.perks.PerkRegeneration;
public class KitHumanAssassin extends Kit
{
public KitHumanAssassin(ArcadeManager manager)
{
super(manager, "Castle Assassin", KitAvailability.Blue,
new String[]
{
"Able to kill with a single shot!"
},
new Perk[]
{
new PerkFletcher(2, 4, false),
new PerkLeap("Leap", 1.2, 1, 8000),
new PerkPowershot(5, 400),
new PerkRegeneration(0),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW));
}
@EventHandler
public void FireItemResist(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (Manager.GetGame() == null)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
}
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
}

View File

@ -21,7 +21,7 @@ public class KitHumanKnight extends Kit
{ {
public KitHumanKnight(ArcadeManager manager) public KitHumanKnight(ArcadeManager manager)
{ {
super(manager, "Castle Knight", KitAvailability.Free, super(manager, "Castle Knight", KitAvailability.Green,
new String[] new String[]
{ {
@ -31,7 +31,7 @@ public class KitHumanKnight extends Kit
new Perk[] new Perk[]
{ {
new PerkMammoth(), new PerkMammoth(),
new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true) new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
}, },
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
@ -67,7 +67,8 @@ public class KitHumanKnight extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));

View File

@ -21,7 +21,7 @@ public class KitHumanMarksman extends Kit
{ {
public KitHumanMarksman(ArcadeManager manager) public KitHumanMarksman(ArcadeManager manager)
{ {
super(manager, "Castle Marksman", KitAvailability.Green, super(manager, "Castle Marksman", KitAvailability.Free,
new String[] new String[]
{ {
"Skilled human marksman, can fletch arrows." "Skilled human marksman, can fletch arrows."
@ -62,7 +62,6 @@ public class KitHumanMarksman extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));

View File

@ -61,6 +61,8 @@ public class KitHumanPeasant extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite"));
player.setHealth(4); player.setHealth(4);
DisguiseWolf disguise = new DisguiseWolf(player); DisguiseWolf disguise = new DisguiseWolf(player);

View File

@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit
new Perk[] new Perk[]
{ {
new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000), new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000),
new PerkSpeed(0) new PerkSpeed(0)
}, },
EntityType.PIG_ZOMBIE, EntityType.PIG_ZOMBIE,

View File

@ -41,8 +41,13 @@ public class KitUndeadZombie extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
DisguiseZombie disguise = new DisguiseZombie(player); DisguiseZombie disguise = new DisguiseZombie(player);
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
disguise.SetCustomNameVisible(true); if (Manager.GetGame().GetTeam(player) != null)
{
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
disguise.SetCustomNameVisible(true);
}
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
} }

View File

@ -6,13 +6,13 @@ import org.bukkit.ChatColor;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.horsecharge.kits.*; import nautilus.game.arcade.game.games.horsecharge.kits.*;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
public class Horse extends AsymTeamGame public class Horse extends TeamGame
{ {
public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams) public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
{ {
@ -34,7 +34,7 @@ public class Horse extends AsymTeamGame
"Undead win when all Horsemen are dead.", "Undead win when all Horsemen are dead.",
"", "",
"Teams swap after game is over" "Teams swap after game is over"
}, pastTeams); });
} }
@Override @Override

View File

@ -0,0 +1,183 @@
package nautilus.game.arcade.kit.perks;
import java.util.Iterator;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkPowershot extends Perk
{
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
private WeakHashMap<Arrow, Integer> _arrows = new WeakHashMap<Arrow, Integer>();
private int _max;
private long _tick;
public PerkPowershot(int max, long tick)
{
super("Power Shot", new String[]
{
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Power Shot",
"Arrows deal up to +15 damage"
});
_max = max;
_tick = tick;
}
@EventHandler
public void DrawBow(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
return;
if (!Kit.HasKit(player))
return;
if (!player.getInventory().contains(Material.ARROW))
return;
if (event.getClickedBlock() != null)
if (UtilBlock.usable(event.getClickedBlock()))
return;
//Start Charge
_charge.put(player, 0);
_chargeLast.put(player, System.currentTimeMillis());
}
@EventHandler
public void ChargeBow(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
//Not Charging
if (!_charge.containsKey(cur))
continue;
//Max Charge
if (_charge.get(cur) >= _max)
continue;
//Charge Interval
if (_charge.get(cur) == 0)
{
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
continue;
}
else
{
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
continue;
}
//No Longer Holding Bow
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
_charge.remove(cur);
_chargeLast.remove(cur);
continue;
}
//Increase Charge
_charge.put(cur, _charge.get(cur) + 1);
_chargeLast.put(cur, System.currentTimeMillis());
//Effect
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
}
}
@EventHandler
public void FireBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!(event.getProjectile() instanceof Arrow))
return;
Player player = (Player)event.getEntity();
if (!_charge.containsKey(player))
return;
//Start
_arrows.put((Arrow)event.getProjectile(), _charge.remove(player));
_chargeLast.put(player, System.currentTimeMillis());
}
@EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
return;
if (event.GetDamagerPlayer(true) == null)
return;
if (!(event.GetProjectile() instanceof Arrow))
return;
Arrow arrow = (Arrow)event.GetProjectile();
if (!_arrows.containsKey(arrow))
return;
int charge = _arrows.remove(arrow);
event.AddMod("Power Shot", "Power Shot", charge * 3, true);
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid())
arrowIterator.remove();
}
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
_charge.remove(player);
_chargeLast.remove(player);
}
}

View File

@ -68,19 +68,19 @@ public class PerkSeismicSlamCS extends Perk
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range); HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet()) for (LivingEntity cur : targets.keySet())
{ {
if (!(cur instanceof Player))
return;
if (cur.equals(player)) if (cur.equals(player))
continue; continue;
if (cur instanceof Player) Player other = (Player)cur;
{
Player other = (Player)cur; if (!Manager.GetGame().IsAlive(other))
continue;
if (!Manager.GetGame().IsAlive(other))
continue; if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
continue;
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
continue;
}
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null, Manager.GetDamage().NewDamageEvent(cur, player, null,
@ -101,11 +101,11 @@ public class PerkSeismicSlamCS extends Perk
} }
//Effect //Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
//Inform //Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
} }

View File

@ -11,9 +11,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -81,20 +79,6 @@ public class GameCreationManager implements Listener
//Lobby Display //Lobby Display
Manager.GetLobby().DisplayLast(Manager.GetGame()); Manager.GetLobby().DisplayLast(Manager.GetGame());
//Prepare Round 2 - If Applicable
if (Manager.GetGame() instanceof AsymTeamGame)
{
if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null)
{
_nextGame = Manager.GetGame().GetType();
_nextGameTeams = new HashMap<String, ChatColor>();
for (GameTeam team : Manager.GetGame().GetTeamList())
for (Player player : team.GetPlayers(false))
_nextGameTeams.put(player.getName(), team.GetColor());
}
}
Manager.SetGame(null); Manager.SetGame(null);
} }
} }

View File

@ -55,7 +55,6 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -807,13 +806,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
DisplayWaiting(); DisplayWaiting();
if (game instanceof AsymTeamGame)
{
if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)4);
else WriteGameLine("Round 2 of 2", 2, 159, (byte)4);
}
else WriteGameLine(" ", 2, 159, (byte)14);
CreateKits(game); CreateKits(game);
CreateTeams(game); CreateTeams(game);
} }

View File

@ -271,13 +271,6 @@ public class GameManager implements Listener
return; return;
event.GetGame().DeregisterKits(); event.GetGame().DeregisterKits();
for (Player player : UtilServer.getPlayers())
{
Manager.Clear(player);
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
player.teleport(Manager.GetLobby().GetSpawn());
}
} }
@EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA @EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA
@ -528,19 +521,35 @@ public class GameManager implements Listener
} }
@EventHandler @EventHandler
public void PlayerClean(GameStateChangeEvent event) public void PlayerTeleportOut(GameStateChangeEvent event)
{ {
if (event.GetState() != GameState.Dead) if (event.GetState() != GameState.Dead)
return; return;
for (Player player : UtilServer.getPlayers()) final Player[] players = UtilServer.getPlayers();
//Prepare Players
for (int i=0 ; i<players.length ; i++)
{ {
Manager.Clear(player); final Player player = players[i];
player.eject();
player.teleport(Manager.GetLobby().GetSpawn()); UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
public void run()
{
Manager.Clear(player);
UtilInv.Clear(player);
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
player.eject();
player.leaveVehicle();
player.teleport(Manager.GetLobby().GetSpawn());
}
}, i);
} }
} }
@EventHandler @EventHandler
public void disguiseClean(GameStateChangeEvent event) public void disguiseClean(GameStateChangeEvent event)
{ {