1

I'm getting this error:

src\server\model\players\Client.java:1089: error: unreachable statement PlayerSave.saveGame(this); ^ Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error 

this is the code:

 public void destruct() { PlayerSave.saveGame(this); if(disconnected == true) { saveCharacter = true; } if(disconnected == true){ getTradeAndDuel().declineTrade(); } if(session == null) Server.panel.removeEntity(playerName); return; PlayerSave.saveGame(this); if (clanId >= 0) Server.clanChat.leaveClan(playerId, clanId); getPA().removeFromCW(); if (inPits) { Server.fightPits.removePlayerFromPits(playerId); } Misc.println("[DEREGISTERED]: "+playerName+""); PlayerSave.saveGame(this); saveCharacter = true; HostList.getHostList().remove(session); disconnected = true; session.close(); session = null; inStream = null; outStream = null; isActive = false; buffer = null; super.destruct(); } 
0

2 Answers 2

2

This section:

if(session == null) Server.panel.removeEntity(playerName); return; 

is read like this:

if(session == null) { Server.panel.removeEntity(playerName); } return; 

so any code after that return is not run.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to change this:

if (session == null) Server.panel.removeEntity(playerName); return; 

to this

if (session == null) { Server.panel.removeEntity(playerName); return; } 

Your IDE should have a feature to format or pretty your code. It will fix up the indentations making it easy to spot errors like the one you encountered.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.