2016-12-20 00:31:01 +01:00
|
|
|
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|
|
|
|
2017-01-30 21:22:36 +01:00
|
|
|
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 org.json.JSONObject;
|
|
|
|
|
2017-01-08 03:30:03 +01:00
|
|
|
public class PacketLinkServer implements PacketIn, PacketOut {
|
2016-12-20 00:31:01 +01:00
|
|
|
private SubPlugin plugin;
|
|
|
|
|
|
|
|
public PacketLinkServer(SubPlugin plugin) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(plugin)) throw new NullPointerException();
|
2016-12-20 00:31:01 +01:00
|
|
|
this.plugin = plugin;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public JSONObject generate() {
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("name", plugin.subdata.getName());
|
|
|
|
return json;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void execute(JSONObject data) {
|
|
|
|
if (data.getInt("r") != 0) {
|
|
|
|
Bukkit.getLogger().info("SubData > Could not link name with server: " + data.getString("m"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Version getVersion() {
|
|
|
|
return new Version("2.11.0a");
|
|
|
|
}
|
|
|
|
}
|