From bd3641cdac516537b752ed2689e9ab6225c5530c Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 12 Jul 2015 02:51:18 +0200 Subject: [PATCH] Updating TeamSmash with team Generation Methods. --- .../arcade/game/games/smash/SuperSmash.java | 83 ------------- .../game/games/smash/TeamSuperSmash.java | 111 +++++++++++++----- 2 files changed, 84 insertions(+), 110 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 268d53135..85d5b9db6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -80,11 +80,6 @@ public abstract class SuperSmash extends Game private EnderCrystal _powerup = null; private long _nextPowerup = 0; - public boolean Teams = false; - public boolean ForceTeamSize = true; - public int PlayersPerTeam = 2; - public int TeamCount = 0; - private HashSet _restoreBlock = new HashSet(); public SuperSmash(ArcadeManager manager, GameType type) @@ -161,84 +156,6 @@ public abstract class SuperSmash extends Game _nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random()); } - - @EventHandler - public void CustomTeamGeneration(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Recruit) - return; - - if(this.Teams) - { - ArrayList spawns = this.GetTeamList().get(0).GetSpawns(); - this.GetTeamList().clear(); - - TeamColors color = TeamColors.DARK_AQUA; - - if(!this.ForceTeamSize) - { - for(int i = 1; i <= this.TeamCount; i++) - { - color = getNextColor(color); - GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns); - team.SetVisible(true); - GetTeamList().add(team); - } - } - else - { - for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++) - { - System.out.println("Test"); - color = getNextColor(color); - GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns); - team.SetVisible(true); - GetTeamList().add(team); - } - } - } - } - - private enum TeamColors - { - - YELLOW(ChatColor.YELLOW), - GREEN(ChatColor.GREEN), - AQUA(ChatColor.AQUA), - DARK_RED(ChatColor.DARK_RED), - GOLD(ChatColor.GOLD), - LIGHT_PURPLE(ChatColor.LIGHT_PURPLE), - DARK_BLUE(ChatColor.DARK_BLUE), - WHITE(ChatColor.WHITE), - BLUE(ChatColor.BLUE), - DARK_GREEN(ChatColor.DARK_GREEN), - DARK_PURPLE(ChatColor.DARK_PURPLE), - DARK_AQUA(ChatColor.DARK_AQUA); - - private ChatColor color; - - private TeamColors(ChatColor color) - { - this.color = color; - } - - public ChatColor getColor() - { - return this.color; - } - - } - - private TeamColors getNextColor(TeamColors color) - { - for(TeamColors colors : TeamColors.values()) { - if(colors.ordinal() == color.ordinal() + 1) - { - return colors; - } - } - return TeamColors.YELLOW; - } @EventHandler public void PlayerOut(PlayerDeathEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 2b9d91664..ae652d353 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -1,49 +1,31 @@ package nautilus.game.arcade.game.games.smash; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.smash.kits.*; -import nautilus.game.arcade.kit.Kit; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; public class TeamSuperSmash extends SuperSmash { + public boolean ForceTeamSize = true; + public int PlayersPerTeam = 2; + public int TeamCount = 0; + public TeamSuperSmash(ArcadeManager manager) { super(manager, GameType.SmashTeams); - this.Teams = true; this.PlayersPerTeam = 2; } @@ -89,6 +71,81 @@ public class TeamSuperSmash extends SuperSmash Scoreboard.Draw(); } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + ArrayList spawns = this.GetTeamList().get(0).GetSpawns(); + this.GetTeamList().clear(); + + TeamColors color = TeamColors.DARK_AQUA; + + if(!this.ForceTeamSize) + { + for(int i = 1; i <= this.TeamCount; i++) + { + color = getNextColor(color); + GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns); + team.SetVisible(true); + GetTeamList().add(team); + } + } + else + { + for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++) + { + System.out.println("Test"); + color = getNextColor(color); + GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns); + team.SetVisible(true); + GetTeamList().add(team); + } + } + } + + private enum TeamColors + { + + YELLOW(ChatColor.YELLOW), + GREEN(ChatColor.GREEN), + AQUA(ChatColor.AQUA), + DARK_RED(ChatColor.DARK_RED), + GOLD(ChatColor.GOLD), + LIGHT_PURPLE(ChatColor.LIGHT_PURPLE), + DARK_BLUE(ChatColor.DARK_BLUE), + WHITE(ChatColor.WHITE), + BLUE(ChatColor.BLUE), + DARK_GREEN(ChatColor.DARK_GREEN), + DARK_PURPLE(ChatColor.DARK_PURPLE), + DARK_AQUA(ChatColor.DARK_AQUA); + + private ChatColor color; + + private TeamColors(ChatColor color) + { + this.color = color; + } + + public ChatColor getColor() + { + return this.color; + } + + } + + private TeamColors getNextColor(TeamColors color) + { + for(TeamColors colors : TeamColors.values()) { + if(colors.ordinal() == color.ordinal() + 1) + { + return colors; + } + } + return TeamColors.YELLOW; + } @Override public void EndCheck()