monkey-island/src/fr/eseo/game/network/MonkeyIsland.java
private void onDisconnection() {
            System.err.println(this + "Disconnected");
            Pirate pirate = island.removePirate(this.com.getPort());
            try {
                island.getPirates().remove(pirate.getId());
                island.deleteObserver(pirate);
            } catch (NullPointerException e){
                System.err.println(this + "Pirate is null");
            }
            coms.remove(this.com.getPort());

            try {
                this.com.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
/**
         * On the disconnection of the client.
         * Remove Pirate and client's com from the map.
         * Then, close client's socket.
         */
On the disconnection of the client.
Remove Pirate and client's com from the map.
Then, close client's socket.
On the disconnection of the client . Remove Pirate and client ' s com from the map . Then close client ' s socket .
private void onDisconnection() {
            System.err.println(this + "Disconnected");
            Pirate pirate = island.removePirate(this.com.getPort());
            try {
                island.getPirates().remove(pirate.getId());
                island.deleteObserver(pirate);
            } catch (NullPointerException e){
                System.err.println(this + "Pirate is null");
            }
            coms.remove(this.com.getPort());
            try {
                this.com.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
private void onDisconnection ( ) { System . err . println ( this + "Disconnected" ) ; Pirate pirate = island . removePirate ( this . com . getPort ( ) ) ; try { island . getPirates ( ) . remove ( pirate . getId ( ) ) ; island . deleteObserver ( pirate ) ; } catch ( NullPointerException e ) { System . err . println ( this + "Pirate is null" ) ; } coms . remove ( this . com . getPort ( ) ) ; try { this . com . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
On the disconnection of the client.
On the disconnection of the client .