// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   boggleServer.java

package boggle.server;

import boggle.server.comms.serverClient;
import boggle.settings;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

// Referenced classes of package boggle.server:
//            boggleServerInterface, messageServer, playerPool

public class boggleServer extends UnicastRemoteObject
    implements boggleServerInterface
{

    public boggleServer(serverClient serverclient)
        throws RemoteException
    {
        playerPool.initialise(serverclient);
    }

    public int Signup(String s, String s1, int i)
        throws RemoteException
    {
        int j = playerPool.addPlayer(s, s1, i);
        if(j == -2)
            messageServer.broadcast("System: Too many players, can't create new.", -1);
        return j;
    }

    public void logout(int i)
        throws RemoteException
    {
        playerPool.logout(i);
        messageServer.broadcast("System: " + playerPool.getPlayerName(i) + " just logged out.", -1);
    }

    public int login(String s, int i, int j)
        throws RemoteException
    {
        int k = playerPool.login(s, i, j);
        if(k >= 0)
            messageServer.broadcast("System: " + s + " has just logged in (" + settings.getLanguages()[j] + ")", -1);
        return k;
    }

    public String[] getLanguageList()
        throws RemoteException
    {
        return settings.getLanguages();
    }

    public String[] getGameList()
        throws RemoteException
    {
        return settings.getGameNames();
    }

    public int getPlayers()
        throws RemoteException
    {
        return playerPool.getLoggedIn();
    }

    public String[] getPlayerList()
        throws RemoteException
    {
        int i = getPlayers();
        String as[] = new String[i];
        for(int j = 0; j < i; j++)
            as[j] = playerPool.getPlayerStatus(j);

        return as;
    }
}

