/* 
	Copyright (C) 2017  Giannis Marinakis
	
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	LICENSE file for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package open_nl.server;
 

//This class stores data for the server 
public class ServerStorage {
	//public static ArrayList<SClient> clients = new ArrayList<SClient>();
	public static SClient[] clients;
	public static int clientIDCounter = 0;
	
	public static int addClient(SClient client) {
		for(int i = 0; i < clients.length; i++) {
			if(clients[i] == null) {
				clients[i] = client;
				return i;
			}
		}
		return -1;
		
	}
	
	public static void removeClient(SClient client) {
		for(int i = 0; i < clients.length; i++) {
			if(clients[i] == client) {
				clients[i] = null;
				break;
			}
		}
	}
} 
/* 
	Copyright (C) 2017  Giannis Marinakis
	
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	LICENSE file for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package open_nl.server;
 

//This class stores data for the server 
public class ServerStorage {
	//public static ArrayList<SClient> clients = new ArrayList<SClient>();
	public static SClient[] clients;
	public static int clientIDCounter = 0;
	
	private ServerStorage() {}
	
	public static int addClient(SClient client) {
		for(int i = 0; i < clients.length; i++) {
			if(clients[i] == null) {
				clients[i] = client;
				return i;
			}
		}
		return -1;
		
	}
	
	public static void removeClient(SClient client) {
		for(int i = 0; i < clients.length; i++) {
			if(clients[i] == client) {
				clients[i] = null;
				break;
			}
		}
	}
} 

Update ServerStorage.java