-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCraftSwitcherAPI.java
More file actions
55 lines (42 loc) · 1.76 KB
/
Copy pathCraftSwitcherAPI.java
File metadata and controls
55 lines (42 loc) · 1.76 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.gmail.necnionch.myapp.craftswitcherreportmodule.v1;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.CraftSwitcherReporter;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.SwitcherServer;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.reporter.IReporter;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.socket.SerializableData;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.socket.TCPClient;
import com.gmail.necnionch.myapp.craftswitcherreportmodule.utils.CompleteFuture;
public class CraftSwitcherAPI {
private static CraftSwitcherReporter craft = CraftSwitcherReporter.getInstance();
public static String getCurrentServerId() {
return craft.getServerName();
}
public static SwitcherServer[] getServers() {
return craft.getServers();
}
public static String[] getServerNames() {
return craft.getServerNames();
}
public static SwitcherServer getServer(String id) {
return craft.getServer(id);
}
public static CompleteFuture makeSendFuture(SerializableData data) {
return craft.sendDataFuture(data);
}
public static void addClientListener(TCPClient.OnClientListener listener) {
craft.getSocket().addListener(listener);
}
public static void removeClientListener(TCPClient.OnClientListener listener) {
craft.getSocket().removeListener(listener);
}
public static boolean isAvailableSwitcher() {
return craft.getSocket().isAvailable();
}
public static IReporter getReporter() {
return craft.getReporter();
}
public static String getReporterName() {
if (craft.getReporter() != null)
return craft.getReporter().getReporterName();
return null;
}
}