aboutsummaryrefslogtreecommitdiffstats
path: root/src/ClientTools.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientTools.hx')
-rw-r--r--src/ClientTools.hx26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ClientTools.hx b/src/ClientTools.hx
new file mode 100644
index 0000000..4503ada
--- /dev/null
+++ b/src/ClientTools.hx
@@ -0,0 +1,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