Arreglado distintos clientes
This commit is contained in:
		
							parent
							
								
									b0db99d83a
								
							
						
					
					
						commit
						5e4545cbfb
					
				| @ -29,24 +29,28 @@ public class ComunacacionJugador extends Thread{ | ||||
| 			 | ||||
| 			if(Servidor.salas.get(sala).getJugador1().equals(this.socket)) { | ||||
| 				bufferSalida.println("Esperando al segundo jugador"); | ||||
| 				synchronized (getClass()) { | ||||
| 					this.getClass().wait(); | ||||
| 				synchronized (this.socket) { | ||||
| 					this.socket.wait(); | ||||
| 				} | ||||
| 				turno = 1; | ||||
| 				bufferSalida.println("Primero"); | ||||
| 				bufferSalida.println(Servidor.salas.get(sala).tablero.getTablero()); | ||||
| 				Servidor.salas.get(sala).tablero.colocarFicha(Integer.parseInt(bufferEntrada.readLine()),  | ||||
| 						Integer.parseInt(bufferEntrada.readLine()),turno); | ||||
| 				synchronized (getClass()) { | ||||
| 					this.getClass().notifyAll(); | ||||
| 					this.getClass().wait(); | ||||
| 				synchronized (Servidor.salas.get(sala).jugadores[turno%2]) { | ||||
| 					Servidor.salas.get(sala).jugadores[turno%2].notify(); | ||||
| 				} | ||||
| 				synchronized (this.socket) { | ||||
| 					this.socket.wait(); | ||||
| 				} | ||||
| 			}else { | ||||
| 				bufferSalida.println("Iniciando partida"); | ||||
| 				bufferSalida.println("Segundo"); | ||||
| 				synchronized (getClass()) { | ||||
| 					this.getClass().notifyAll(); | ||||
| 					this.getClass().wait(); | ||||
| 				synchronized (Servidor.salas.get(sala).jugadores[turno%2]) { | ||||
| 					Servidor.salas.get(sala).jugadores[turno%2].notify(); | ||||
| 				} | ||||
| 				synchronized (this.socket) { | ||||
| 					this.socket.wait(); | ||||
| 				} | ||||
| 			} | ||||
| 			while(continuar) { | ||||
| @ -58,16 +62,18 @@ public class ComunacacionJugador extends Thread{ | ||||
| 					}else { | ||||
| 						bufferSalida.println("f"); | ||||
| 					} | ||||
| 					synchronized (getClass()) { | ||||
| 						this.getClass().notifyAll(); | ||||
| 					synchronized (Servidor.salas.get(sala).jugadores[turno%2]) { | ||||
| 						Servidor.salas.get(sala).jugadores[turno%2].notify(); | ||||
| 					} | ||||
| 				}else { | ||||
| 					bufferSalida.println(Servidor.salas.get(sala).tablero.getTablero()); | ||||
| 					Servidor.salas.get(sala).tablero.colocarFicha(Integer.parseInt(bufferEntrada.readLine()),  | ||||
| 							Integer.parseInt(bufferEntrada.readLine()),turno); | ||||
| 					synchronized (getClass()) { | ||||
| 						this.getClass().notifyAll(); | ||||
| 						this.getClass().wait(); | ||||
| 					synchronized (Servidor.salas.get(sala).jugadores[turno%2]) { | ||||
| 						Servidor.salas.get(sala).jugadores[turno%2].notify(); | ||||
| 					} | ||||
| 					synchronized (this.socket) { | ||||
| 						this.socket.wait(); | ||||
| 					} | ||||
| 				} | ||||
| 				 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user