-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientListener.java~
More file actions
38 lines (34 loc) · 1.05 KB
/
ClientListener.java~
File metadata and controls
38 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.net.*;
import java.util.*;
public class ClientListener extends Thread{
FrogMover fm;
MyConnection c;
String msg, winner, bets[2];
public ClientListener(FrogMover fm, MyConnection c){
this.fm = fm;
this.c = c;
}
public void run(){
try{
while (true) {
msg = c.getMessage();
//System.out.println(msg);
if(msg.startsWith("GAME START!")){
fm.winner = c.getMessage(); System.out.println(fm.jump);
bets[0] = c.getMessage();
bets[1] = c.getMessage();
fm.bet_total = Integer.parseInt(bets[0]) + Integer.parseInt(bets[1]);
winner = fm.winner;
fm.jump = 1;//System.out.println(fm.winner + "JUMP " + fm.jump);
}
}
}catch(Exception e){
e.printStackTrace();
}
try{
c.connectionSocket.close();
}catch(Exception e){
e.printStackTrace();
}
}
}