Skip to content

Commit

Permalink
Phantom regions
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberpwnn committed Jul 14, 2016
1 parent cfd249a commit 128dbb3
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/main/java/org/cyberpwn/phantom/game/PhantomRegion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.cyberpwn.phantom.game;

import org.bukkit.entity.Player;
import org.cyberpwn.phantom.lang.GList;
import org.cyberpwn.phantom.world.ChunkletMesh;

public class PhantomRegion<R extends Region<R, M, G, T, P>, M extends GameMap<M, G, T, P>, G extends Game<M, G, T, P>, T extends Team<M, G, T, P>, P extends GamePlayer<M, G, T, P>> implements Region<R, M, G, T, P>
{
private ChunkletMesh mesh;
private M map;

public PhantomRegion(M map)
{
this.map = map;
this.mesh = new ChunkletMesh(map.getWorld());
}

@Override
public M getMap()
{
return map;
}

@Override
public G getGame()
{
return getMap().getGame();
}

@Override
public boolean contains(P player)
{
return mesh.contains(player.getPlayer());
}

@Override
public boolean contains(Player player)
{
return mesh.contains(player);
}

@Override
public GList<P> getGamePlayers()
{
GList<P> players = new GList<P>();

for(Player i : getPlayers())
{
if(getGame().contains(i))
{
players.add(getGame().getGamePlayer(i));
}
}

return players;
}

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

0 comments on commit 128dbb3

Please sign in to comment.