blob: 3a6dcd7cb4f4733ee79b36bc51a267ef4dfa9bb9 (
plain)
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
|
import socketData from "../../../soopyApis/socketData";
import WebsiteCommunicator from "../../../soopyApis/websiteCommunicator";
class MineWayPointsServer extends WebsiteCommunicator {
constructor() {
super(socketData.serverNameToId.minewaypoints);
this.setLocationHandler = undefined
this.hypixelServer = undefined
this.lastSend = Date.now()
}
onConnect() {
this.hypixelServer = undefined
}
onData(data) {
switch (data.type) {
case "setLocation":
if (this.setLocationHandler) {
this.setLocationHandler(data.area, data.location);
}
break;
}
}
setLocation(area, loc) {
this.sendData({
type: "setLocation",
area: area,
location: loc
});
}
setServer(server, worldTime) {
if (this.hypixelServer === server && Date.now() - this.lastSend < 10000) return;
this.lastSend = Date.now()
this.hypixelServer = server
this.sendData({
type: "setServer",
server: server,
time: worldTime
});
}
}
global.soopyV2mineWayPointsServer = new MineWayPointsServer()
export default global.soopyV2mineWayPointsServer;
|