-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/main/java/org/cyberpwn/phantom/game/PhantomRegion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |