Updating TeamSmash with team Generation Methods.
This commit is contained in:
parent
251accb40a
commit
bd3641cdac
@ -80,11 +80,6 @@ public abstract class SuperSmash extends Game
|
|||||||
private EnderCrystal _powerup = null;
|
private EnderCrystal _powerup = null;
|
||||||
private long _nextPowerup = 0;
|
private long _nextPowerup = 0;
|
||||||
|
|
||||||
public boolean Teams = false;
|
|
||||||
public boolean ForceTeamSize = true;
|
|
||||||
public int PlayersPerTeam = 2;
|
|
||||||
public int TeamCount = 0;
|
|
||||||
|
|
||||||
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
|
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
|
||||||
|
|
||||||
public SuperSmash(ArcadeManager manager, GameType type)
|
public SuperSmash(ArcadeManager manager, GameType type)
|
||||||
@ -162,84 +157,6 @@ public abstract class SuperSmash extends Game
|
|||||||
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
|
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
|
||||||
{
|
|
||||||
if (event.GetState() != GameState.Recruit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(this.Teams)
|
|
||||||
{
|
|
||||||
ArrayList<Location> 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
|
@EventHandler
|
||||||
public void PlayerOut(PlayerDeathEvent event)
|
public void PlayerOut(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
|
@ -1,49 +1,31 @@
|
|||||||
package nautilus.game.arcade.game.games.smash;
|
package nautilus.game.arcade.game.games.smash;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
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.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
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.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.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
|
||||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
import org.bukkit.ChatColor;
|
||||||
import nautilus.game.arcade.game.TeamGame;
|
import org.bukkit.Location;
|
||||||
import nautilus.game.arcade.game.games.smash.kits.*;
|
import org.bukkit.entity.Player;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
public class TeamSuperSmash extends SuperSmash
|
public class TeamSuperSmash extends SuperSmash
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public boolean ForceTeamSize = true;
|
||||||
|
public int PlayersPerTeam = 2;
|
||||||
|
public int TeamCount = 0;
|
||||||
|
|
||||||
public TeamSuperSmash(ArcadeManager manager)
|
public TeamSuperSmash(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, GameType.SmashTeams);
|
super(manager, GameType.SmashTeams);
|
||||||
|
|
||||||
this.Teams = true;
|
|
||||||
this.PlayersPerTeam = 2;
|
this.PlayersPerTeam = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +72,81 @@ public class TeamSuperSmash extends SuperSmash
|
|||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() != GameState.Recruit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ArrayList<Location> 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
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user