Last change
on this file since 34ccb37 was 34ccb37, checked in by ZeroCool <devnull@…>, 14 years ago |
Attempt at first cmmit. AGAIN :(
|
-
Property mode
set to
100644
|
File size:
779 bytes
|
Rev | Line | |
---|
[34ccb37] | 1 | import java.util.Vector;
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | public class GameRoom extends Thread{
|
---|
| 5 | private final int maxNumberOfPlayers;
|
---|
| 6 | private final String roomName;
|
---|
| 7 | private Vector<Connection> players;
|
---|
| 8 |
|
---|
| 9 | public GameRoom(int maxNumberOfPlayers, String roomName) {
|
---|
| 10 | this.maxNumberOfPlayers = maxNumberOfPlayers;
|
---|
| 11 | this.roomName = roomName;
|
---|
| 12 | this.players = new Vector<Connection>();
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public boolean addPlayer(Connection newPlayer){
|
---|
| 16 | if(maxNumberOfPlayers > players.size()){
|
---|
| 17 | players.add(newPlayer);
|
---|
| 18 | return true;
|
---|
| 19 | }
|
---|
| 20 | return false;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | public void run() {
|
---|
| 25 |
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public int getNumberOfPlayers(){
|
---|
| 29 | return players.size();
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public int getMaxNumberOfPlayers(){
|
---|
| 33 | return maxNumberOfPlayers;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public String getRoomName(){
|
---|
| 37 | return roomName;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.