Skip to content

Commit

Permalink
Phantom Teams
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberpwnn committed Jul 12, 2016
1 parent 8eedaf3 commit 48399be
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions src/main/java/org/cyberpwn/phantom/game/PhantomTeam.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package org.cyberpwn.phantom.game;

import org.bukkit.entity.Player;
import org.cyberpwn.phantom.lang.GList;
import org.cyberpwn.phantom.util.C;

public class PhantomTeam<G extends Game<G, T, P>, T extends Team<G, T, P>, P extends GamePlayer<G, T, P>> implements Team<G,T, P>
{
private String name;
private C color;
private G game;
private GList<Player> players;
private GList<P> gamePlayers;

public PhantomTeam(String name, C color, G game)
{
this.name = name;
this.color = color;
this.game = game;
this.players = new GList<Player>();
this.gamePlayers = new GList<P>();
}

@Override
public C getColor()
{
return color;
}

@Override
public String getName()
{
return name;
}

@Override
public GList<Player> getPlayers()
{
return players;
}

@Override
public GList<P> getGamePlayers()
{
return gamePlayers;
}

@Override
public G getGame()
{
return game;
}

@Override
public Integer size()
{
return gamePlayers.size();
}

@Override
public Boolean contains(P p)
{
return gamePlayers.contains(p);
}

@Override
public Boolean contains(Player p)
{
return players.contains(p);
}

@Override
public void add(P p)
{
if(!contains(p))
{
gamePlayers.add(p);
players.add(p.getPlayer());
}
}

@Override
public void remove(P p)
{
if(contains(p))
{
gamePlayers.remove(p);
players.remove(p.getPlayer());
}
}

@Override
public void setColor(C color)
{
this.color = color;
}
}

0 comments on commit 48399be

Please sign in to comment.