public void protocolBall() { /* On met à jour la position de la balle */ int positionBallX = Integer.parseInt(tab[1]); int positionBallY = Integer.parseInt(tab[2]); Ball ball = pong.getBall(); /* Anti-cheat */ if ((positionBallX > (ball.getPositionX() + ball.getSpeedX()) && ball.getSpeedX() > 0) || (positionBallX < (ball.getPositionX() + ball.getSpeedX()) && ball.getSpeedX() < 0) || (positionBallY > (ball.getPositionY() + ball.getSpeedY()) && ball.getSpeedY() > 0) || (positionBallY < (ball.getPositionY() + ball.getSpeedY()) && ball.getSpeedY() < 0)) { errorCheat("Balle avec coordonnées invalides (cheat)"); } ball.setPosition(new Point(positionBallX, positionBallY)); pong.setBall(ball); /* On met à jour les scores */ for (int i = 3; i < tab.length; i++) { String[] curPlayer = tab[i].split(";"); PlayerID playerID = PlayerID.valueOf(curPlayer[0]); int score = Integer.parseInt(curPlayer[1]); Iterator<Player> it = pong.setPlayers.iterator(); while (it.hasNext()) { Player player = it.next(); if (player.getPlayerID() == playerID) { player.setScore(score); } } } }