aboutsummaryrefslogtreecommitdiffstats
path: root/src/ClientTools.hx
blob: 4503ada8c00dcafc35193315e70a02612b245a33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package;

class ClientTools {

	public static function setLeader(clients:Array<Client>, name:String):Void {
		for (client in clients) {
			if (client.name == name) client.isLeader = true;
			else if (client.isLeader) client.isLeader = false;
		}
	}

	public static function hasLeader(clients:Array<Client>):Bool {
		for (client in clients) {
			if (client.isLeader) return true;
		}
		return false;
	}

	public static function getByName(clients:Array<Client>, name:String):Null<Client> {
		for (client in clients) {
			if (client.name == name) return client;
		}
		return null;
	}

}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage