aboutsummaryrefslogtreecommitdiffstats
path: root/src/ClientTools.hx
blob: 46400f7a8b3e524381ea08afddaa6f90179e4ea0 (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
27
28
29
package;

import Types.Permission;
import Types.Permissions;

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, ?def:Client
	):Null<Client> {
		for (client in clients) {
			if (client.name == name) return client;
		}
		return def;
	}
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage