SubServers-2/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Network/Packet/PacketDownloadLang.java

56 lines
1.6 KiB
Java
Raw Normal View History

2016-12-20 00:31:01 +01:00
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
import net.ME1312.SubServers.Client.Bukkit.Library.Config.YAMLSection;
import net.ME1312.SubServers.Client.Bukkit.Library.NamedContainer;
import net.ME1312.SubServers.Client.Bukkit.Library.Util;
2016-12-20 00:31:01 +01:00
import net.ME1312.SubServers.Client.Bukkit.Library.Version.Version;
import net.ME1312.SubServers.Client.Bukkit.Network.PacketIn;
import net.ME1312.SubServers.Client.Bukkit.Network.PacketOut;
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
import org.bukkit.Bukkit;
import java.lang.reflect.Field;
2016-12-20 00:31:01 +01:00
import java.util.Calendar;
/**
* Download Lang Packet
*/
2016-12-20 00:31:01 +01:00
public class PacketDownloadLang implements PacketIn, PacketOut {
private SubPlugin plugin;
/**
* New PacketDownloadLang (In)
*
* @param plugin SubServers.Client
*/
2016-12-20 00:31:01 +01:00
public PacketDownloadLang(SubPlugin plugin) {
if (Util.isNull(plugin)) throw new NullPointerException();
2016-12-20 00:31:01 +01:00
this.plugin = plugin;
}
/**
* New PacketDownloadLang (Out)
*/
public PacketDownloadLang() {}
2016-12-20 00:31:01 +01:00
@Override
public YAMLSection generate() {
2016-12-20 00:31:01 +01:00
return null;
}
@Override
public void execute(YAMLSection data) {
try {
2019-01-15 00:28:18 +01:00
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getSection("Lang").get()));
Bukkit.getLogger().info("SubData > Lang Settings Downloaded");
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
2016-12-20 00:31:01 +01:00
}
@Override
public Version getVersion() {
return new Version("2.11.0a");
}
}