3D spaceshooter with online scoreboard, online demos, ship building. Now entirely defunct, but might be resurrected
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sector/src/net/sector/threads/ThreadLoadAndActivateProfil...

39 lines
1.0 KiB

package net.sector.threads;
import static net.sector.threads.EThreadStatus.*;
import net.sector.level.SuperContext;
import net.sector.network.UserProfile;
import net.sector.network.communication.ServerError;
import net.sector.util.Log;
/**
* Thread activating all user profiles in SuperContext.
*
* @author Ondřej Hruška (MightyPork)
*/
public class ThreadLoadAndActivateProfiles extends Thread {
/** Thread status */
public static EThreadStatus status = UNSTARTED;
@Override
public void run() {
status = WORKING;
Log.f2("THREAD: Loading file with user logins.");
SuperContext.loadUserList();
for (UserProfile p : SuperContext.userProfiles) {
try {
Log.f2("THREAD: Activating profile " + p.uname);
p.logIn();
Log.f2("THREAD: Profile " + p.uname + " activated.");
} catch (ServerError e) {
Log.w("THREAD: Could not activate profile " + p.uname + ": " + e.getMessage());
}
}
if (SuperContext.selectedUser != null && !SuperContext.selectedUser.isActivated()) SuperContext.selectedUser = null;
status = SUCCESS;
}
}