/
PacketDownloadLang.java
49 lines (42 loc) · 1.43 KB
/
PacketDownloadLang.java
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
package net.ME1312.SubServers.Velocity.Network.Packet;
import net.ME1312.Galaxi.Library.Container.ContainedPair;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
import net.ME1312.SubData.Client.Protocol.PacketOut;
import net.ME1312.SubData.Client.SubDataSender;
import net.ME1312.SubServers.Velocity.ExProxy;
import net.ME1312.SubServers.Velocity.Library.Compatibility.Logger;
import java.util.Calendar;
/**
* Download Lang Packet
*/
public class PacketDownloadLang implements PacketObjectIn<Integer>, PacketOut {
private ExProxy plugin;
/**
* New PacketDownloadLang (In)
*
* @param plugin SubServers.Client
*/
public PacketDownloadLang(ExProxy plugin) {
Util.nullpo(plugin);
this.plugin = plugin;
}
/**
* New PacketDownloadLang (Out)
*/
public PacketDownloadLang() {}
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
try {
Util.reflect(ExProxy.class.getDeclaredField("lang"), plugin, new ContainedPair<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
Logger.get("SubData").info("Lang Settings Downloaded");
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
@Override
public int version() {
return 0x0001;
}
}