mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 18:26:06 +01:00
Update SubData
This commit is contained in:
parent
b7639ae3dc
commit
bfcb076cfd
@ -43,7 +43,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.SubData</groupId>
|
<groupId>net.ME1312.SubData</groupId>
|
||||||
<artifactId>Server</artifactId>
|
<artifactId>Server</artifactId>
|
||||||
<version>19w39a</version>
|
<version>19w42c</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
package net.ME1312.SubServers.Bungee.Network.Packet;
|
package net.ME1312.SubServers.Bungee.Network.Packet;
|
||||||
|
|
||||||
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Server.SubDataClient;
|
import net.ME1312.SubData.Server.SubDataClient;
|
||||||
import net.ME1312.SubServers.Bungee.Host.Server;
|
|
||||||
import net.ME1312.SubServers.Bungee.SubAPI;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Permission Packet
|
* Check Permission Packet
|
||||||
*/
|
*/
|
||||||
public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
private boolean result;
|
static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
||||||
|
private UUID player;
|
||||||
|
private String permission;
|
||||||
private UUID tracker;
|
private UUID tracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,35 +29,28 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
*
|
*
|
||||||
* @param player Player to check on
|
* @param player Player to check on
|
||||||
* @param permission Permission to check
|
* @param permission Permission to check
|
||||||
* @param tracker Receiver ID
|
* @param callback Callbacks
|
||||||
*/
|
*/
|
||||||
public PacketCheckPermission(UUID player, String permission, UUID tracker) {
|
@SafeVarargs
|
||||||
this(Util.getDespiteException(() -> ProxyServer.getInstance().getPlayer(player).hasPermission(permission), false), tracker);
|
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
||||||
}
|
this.player = player;
|
||||||
|
this.permission = permission;
|
||||||
PacketCheckPermission(boolean result, UUID tracker) {
|
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
||||||
this.result = result;
|
callbacks.put(tracker, callback);
|
||||||
this.tracker = tracker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, result);
|
data.set(0x0001, player);
|
||||||
|
data.set(0x0002, permission);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
||||||
Server server = data.contains(0x0003)?SubAPI.getInstance().getServer(data.getRawString(0x0003)):null;
|
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||||
if (server != null && server.getSubData()[0] != null) {
|
|
||||||
((SubDataClient) server.getSubData()[0]).sendPacket(new PacketExCheckPermission(data.getUUID(0x0001), data.getRawString(0x0002), result -> {
|
|
||||||
client.sendPacket(new PacketCheckPermission(result, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
client.sendPacket(new PacketCheckPermission(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,45 +6,42 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Server.SubDataClient;
|
import net.ME1312.SubData.Server.SubDataClient;
|
||||||
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static net.ME1312.SubServers.Bungee.Network.Packet.PacketCheckPermission.callbacks;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Check Permission
|
* Check Permission Response Packet
|
||||||
*/
|
*/
|
||||||
public class PacketExCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
public class PacketCheckPermissionResponse implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
private static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
private boolean result;
|
||||||
private UUID player;
|
|
||||||
private String permission;
|
|
||||||
private UUID tracker;
|
private UUID tracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New PacketCheckPermission (In)
|
* New PacketCheckPermissionResponse (In)
|
||||||
*/
|
*/
|
||||||
public PacketExCheckPermission() {}
|
public PacketCheckPermissionResponse() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New PacketCheckPermission (Out)
|
* New PacketCheckPermissionResponse (Out)
|
||||||
*
|
*
|
||||||
* @param player Player to check on
|
* @param player Player to check on
|
||||||
* @param permission Permission to check
|
* @param permission Permission to check
|
||||||
* @param callback Callbacks
|
* @param tracker Receiver ID
|
||||||
*/
|
*/
|
||||||
@SafeVarargs
|
public PacketCheckPermissionResponse(UUID player, String permission, UUID tracker) {
|
||||||
public PacketExCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
this.result = Util.getDespiteException(() -> ProxyServer.getInstance().getPlayer(player).hasPermission(permission), false);
|
||||||
this.player = player;
|
this.tracker = tracker;
|
||||||
this.permission = permission;
|
|
||||||
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
|
||||||
callbacks.put(tracker, callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, player);
|
data.set(0x0001, result);
|
||||||
data.set(0x0002, permission);
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -51,6 +51,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
||||||
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
||||||
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
||||||
|
instance.registerPacket(0x0018, PacketCheckPermissionResponse.class);
|
||||||
|
|
||||||
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
||||||
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo(plugin));
|
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo(plugin));
|
||||||
@ -60,6 +61,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, new PacketDownloadServerInfo(plugin));
|
instance.registerPacket(0x0015, new PacketDownloadServerInfo(plugin));
|
||||||
instance.registerPacket(0x0016, new PacketDownloadPlayerList(plugin));
|
instance.registerPacket(0x0016, new PacketDownloadPlayerList(plugin));
|
||||||
instance.registerPacket(0x0017, new PacketCheckPermission());
|
instance.registerPacket(0x0017, new PacketCheckPermission());
|
||||||
|
instance.registerPacket(0x0018, new PacketCheckPermissionResponse());
|
||||||
|
|
||||||
|
|
||||||
// 30-4F: Control Packets
|
// 30-4F: Control Packets
|
||||||
@ -113,13 +115,11 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0071, PacketOutExReset.class);
|
instance.registerPacket(0x0071, PacketOutExReset.class);
|
||||||
instance.registerPacket(0x0072, PacketOutExReload.class);
|
instance.registerPacket(0x0072, PacketOutExReload.class);
|
||||||
instance.registerPacket(0x0073, PacketOutExUpdateWhitelist.class);
|
instance.registerPacket(0x0073, PacketOutExUpdateWhitelist.class);
|
||||||
instance.registerPacket(0x0074, PacketExCheckPermission.class);
|
|
||||||
|
|
||||||
//instance.registerPacket(0x0070, new PacketOutRunEvent());
|
//instance.registerPacket(0x0070, new PacketOutRunEvent());
|
||||||
//instance.registerPacket(0x0071, new PacketOutReset());
|
//instance.registerPacket(0x0071, new PacketOutReset());
|
||||||
//instance.registerPacket(0x0072, new PacketOutReload());
|
//instance.registerPacket(0x0072, new PacketOutReload());
|
||||||
//instance.registerPacket(0x0073, new PacketOutExUpdateWhitelist());
|
//instance.registerPacket(0x0073, new PacketOutExUpdateWhitelist());
|
||||||
instance.registerPacket(0x0074, new PacketExCheckPermission());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -11,7 +11,7 @@ import net.ME1312.Galaxi.Library.Version.Version;
|
|||||||
import net.ME1312.SubData.Server.ClientHandler;
|
import net.ME1312.SubData.Server.ClientHandler;
|
||||||
import net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiInfo;
|
import net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiInfo;
|
||||||
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
|
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
|
||||||
import net.ME1312.SubServers.Bungee.Network.Packet.PacketExCheckPermission;
|
import net.ME1312.SubServers.Bungee.Network.Packet.PacketCheckPermission;
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
@ -719,7 +719,7 @@ public final class SubCommand extends CommandX {
|
|||||||
HashMap<ServerInfo, NamedContainer<Long, Boolean>> map = (players.keySet().contains(((ProxiedPlayer) sender).getUniqueId()))?players.get(((ProxiedPlayer) sender).getUniqueId()):new HashMap<ServerInfo, NamedContainer<Long, Boolean>>();
|
HashMap<ServerInfo, NamedContainer<Long, Boolean>> map = (players.keySet().contains(((ProxiedPlayer) sender).getUniqueId()))?players.get(((ProxiedPlayer) sender).getUniqueId()):new HashMap<ServerInfo, NamedContainer<Long, Boolean>>();
|
||||||
map.put(((ProxiedPlayer) sender).getServer().getInfo(), new NamedContainer<>(null, false));
|
map.put(((ProxiedPlayer) sender).getServer().getInfo(), new NamedContainer<>(null, false));
|
||||||
players.put(((ProxiedPlayer) sender).getUniqueId(), map);
|
players.put(((ProxiedPlayer) sender).getUniqueId(), map);
|
||||||
((SubDataClient) ((Server) ((ProxiedPlayer) sender).getServer().getInfo()).getSubData()[0]).sendPacket(new PacketExCheckPermission(((ProxiedPlayer) sender).getUniqueId(), "subservers.command", result -> {
|
((SubDataClient) ((Server) ((ProxiedPlayer) sender).getServer().getInfo()).getSubData()[0]).sendPacket(new PacketCheckPermission(((ProxiedPlayer) sender).getUniqueId(), "subservers.command", result -> {
|
||||||
map.put(((ProxiedPlayer) sender).getServer().getInfo(), new NamedContainer<>(Calendar.getInstance().getTime().getTime(), result));
|
map.put(((ProxiedPlayer) sender).getServer().getInfo(), new NamedContainer<>(Calendar.getInstance().getTime().getTime(), result));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -727,7 +727,7 @@ public final class SubCommand extends CommandX {
|
|||||||
return new NamedContainer<>(null, Collections.emptyList());
|
return new NamedContainer<>(null, Collections.emptyList());
|
||||||
} else if (args.length <= 1) {
|
} else if (args.length <= 1) {
|
||||||
List<String> cmds = new ArrayList<>();
|
List<String> cmds = new ArrayList<>();
|
||||||
cmds.addAll(Arrays.asList("help", "list", "info", "status", "version", "start", "stop", "restart", "kill", "terminate", "cmd", "command", "create", "update", "upgrade"));
|
cmds.addAll(Arrays.asList("help", "list", "info", "status", "version", "start", "restart", "stop", "kill", "terminate", "cmd", "command", "create", "update", "upgrade"));
|
||||||
if (!(sender instanceof ProxiedPlayer)) cmds.addAll(Arrays.asList("reload", "sudo", "screen", "delete", "restore"));
|
if (!(sender instanceof ProxiedPlayer)) cmds.addAll(Arrays.asList("reload", "sudo", "screen", "delete", "restore"));
|
||||||
if (last.length() == 0) {
|
if (last.length() == 0) {
|
||||||
return new NamedContainer<>(null, cmds);
|
return new NamedContainer<>(null, cmds);
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.SubData</groupId>
|
<groupId>net.ME1312.SubData</groupId>
|
||||||
<artifactId>Client</artifactId>
|
<artifactId>Client</artifactId>
|
||||||
<version>19w39a</version>
|
<version>19w42c</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.*;
|
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.*;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
||||||
|
|
||||||
@ -58,16 +61,16 @@ public class Host {
|
|||||||
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
if (raw.contains("subdata")) {
|
if (raw.contains("subdata")) {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
} else {
|
} else {
|
||||||
return new UUID[0];
|
return new SubDataSender[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadProxyInfo;
|
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadProxyInfo;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
||||||
|
|
||||||
@ -47,13 +50,13 @@ public class Proxy {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,10 @@ package net.ME1312.SubServers.Client.Bukkit.Network.API;
|
|||||||
|
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadServerInfo;
|
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketDownloadServerInfo;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
||||||
|
|
||||||
@ -46,13 +49,13 @@ public class Server {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -102,7 +102,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -113,7 +113,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,19 @@ package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Check Permission
|
* Check Permission Packet
|
||||||
*/
|
*/
|
||||||
public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
public class PacketCheckPermission implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
private static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
||||||
private String name;
|
|
||||||
private UUID player;
|
private UUID player;
|
||||||
private String permission;
|
private String permission;
|
||||||
private UUID tracker;
|
private UUID tracker;
|
||||||
@ -34,20 +34,6 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
*/
|
*/
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
||||||
this(null, player, permission, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketCheckPermission (Out)
|
|
||||||
*
|
|
||||||
* @param server Server to check on
|
|
||||||
* @param player Player to check on
|
|
||||||
* @param permission Permission to check
|
|
||||||
* @param callback Callbacks
|
|
||||||
*/
|
|
||||||
@SafeVarargs
|
|
||||||
public PacketCheckPermission(String server, UUID player, String permission, Callback<Boolean>... callback) {
|
|
||||||
this.name = server;
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
||||||
@ -55,19 +41,17 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, player);
|
data.set(0x0001, player);
|
||||||
data.set(0x0002, permission);
|
data.set(0x0002, permission);
|
||||||
if (name != null) data.set(0x0003, name);
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
||||||
|
|
||||||
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketCheckPermission.callbacks;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Permission Response Packet
|
||||||
|
*/
|
||||||
|
public class PacketCheckPermissionResponse implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
|
private boolean result;
|
||||||
|
private UUID tracker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (In)
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (Out)
|
||||||
|
*
|
||||||
|
* @param player Player to check on
|
||||||
|
* @param permission Permission to check
|
||||||
|
* @param tracker Receiver ID
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse(UUID player, String permission, UUID tracker) {
|
||||||
|
this.result = Util.getDespiteException(() -> Bukkit.getServer().getPlayer(player).hasPermission(permission), false);
|
||||||
|
this.tracker = tracker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
|
data.set(0x0000, tracker);
|
||||||
|
data.set(0x0001, result);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
|
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
||||||
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int version() {
|
||||||
|
return 0x0001;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -44,7 +44,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -54,7 +54,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|||||||
|
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
||||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
@ -109,7 +109,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -123,7 +123,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -45,7 +45,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -56,7 +56,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -40,7 +40,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -49,7 +49,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class PacketDownloadLang implements PacketObjectIn<Integer>, PacketOut {
|
|||||||
public PacketDownloadLang() {}
|
public PacketDownloadLang() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
try {
|
try {
|
||||||
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
||||||
Bukkit.getLogger().info("SubData > Lang Settings Downloaded");
|
Bukkit.getLogger().info("SubData > Lang Settings Downloaded");
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,7 +30,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
return data;
|
return data;
|
||||||
@ -38,7 +38,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -32,7 +32,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
return json;
|
return json;
|
||||||
@ -40,7 +40,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.NamedContainer;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -40,7 +40,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (proxy != null) json.set(0x0001, proxy);
|
if (proxy != null) json.set(0x0001, proxy);
|
||||||
@ -49,7 +49,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (server != null) json.set(0x0001, server);
|
if (server != null) json.set(0x0001, server);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -47,7 +47,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -58,7 +58,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|
||||||
|
|
||||||
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.PacketObjectOut;
|
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* External Check Permission Packet
|
|
||||||
*/
|
|
||||||
public class PacketExCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
|
||||||
private UUID player;
|
|
||||||
private String permission;
|
|
||||||
private UUID tracker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketExCheckPermission (In)
|
|
||||||
*/
|
|
||||||
public PacketExCheckPermission() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketExCheckPermission (Out)
|
|
||||||
*
|
|
||||||
* @param player Player to check on
|
|
||||||
* @param permission Permission to check
|
|
||||||
* @param tracker Receiver ID
|
|
||||||
*/
|
|
||||||
public PacketExCheckPermission(UUID player, String permission, UUID tracker) {
|
|
||||||
this.player = player;
|
|
||||||
this.permission = permission;
|
|
||||||
this.tracker = tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
|
||||||
data.set(0x0000, tracker);
|
|
||||||
data.set(0x0001, Util.getDespiteException(() -> Bukkit.getServer().getPlayer(player).hasPermission(permission), false));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
|
||||||
client.sendPacket(new PacketExCheckPermission(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int version() {
|
|
||||||
return 0x0001;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (data != null && data.contains(0x0000)) Bukkit.getLogger().warning("SubData > Received request for a plugin reload: " + data.getString(0x0000));
|
if (data != null && data.contains(0x0000)) Bukkit.getLogger().warning("SubData > Received request for a plugin reload: " + data.getString(0x0000));
|
||||||
else Bukkit.getLogger().warning("SubData > Received request for a plugin reload");
|
else Bukkit.getLogger().warning("SubData > Received request for a plugin reload");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
|
@ -3,7 +3,7 @@ package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,7 +12,7 @@ import org.bukkit.Bukkit;
|
|||||||
public class PacketInExReset implements PacketObjectIn<Integer> {
|
public class PacketInExReset implements PacketObjectIn<Integer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (data != null && data.contains(0x0000)) Bukkit.getLogger().warning("SubData > Received shutdown signal: " + data.getString(0x0000));
|
if (data != null && data.contains(0x0000)) Bukkit.getLogger().warning("SubData > Received shutdown signal: " + data.getString(0x0000));
|
||||||
else Bukkit.getLogger().warning("SubData > Received shutdown signal");
|
else Bukkit.getLogger().warning("SubData > Received shutdown signal");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
package net.ME1312.SubServers.Client.Bukkit.Network.Packet;
|
||||||
|
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Event.*;
|
import net.ME1312.SubServers.Client.Bukkit.Event.*;
|
||||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
@ -147,7 +147,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
||||||
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
||||||
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.Initial.InitialPacket;
|
import net.ME1312.SubData.Client.Protocol.Initial.InitialPacket;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Event.SubNetworkConnectEvent;
|
import net.ME1312.SubServers.Client.Bukkit.Event.SubNetworkConnectEvent;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
import net.ME1312.SubServers.Client.Bukkit.SubAPI;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
||||||
@ -40,7 +40,7 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
if (plugin.api.getName() != null) json.set(0x0000, plugin.api.getName());
|
if (plugin.api.getName() != null) json.set(0x0000, plugin.api.getName());
|
||||||
json.set(0x0001, Bukkit.getServer().getPort());
|
json.set(0x0001, Bukkit.getServer().getPort());
|
||||||
@ -49,12 +49,12 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (data.getInt(0x0001) == 0) {
|
if (data.getInt(0x0001) == 0) {
|
||||||
try {
|
try {
|
||||||
if (data.contains(0x0000)) {
|
if (data.contains(0x0000)) {
|
||||||
Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||||
setReady(client, true);
|
setReady(client.getConnection(), true);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -43,7 +43,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -53,7 +53,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -41,7 +41,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -50,7 +50,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -41,7 +41,7 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -50,7 +50,7 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -45,7 +45,7 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, id);
|
data.set(0x0000, id);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -55,7 +55,7 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -62,7 +62,7 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -73,7 +73,7 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Library.DisconnectReason;
|
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
import net.ME1312.SubData.Client.SubDataProtocol;
|
import net.ME1312.SubData.Client.SubDataProtocol;
|
||||||
import net.ME1312.SubServers.Client.Bukkit.Event.SubNetworkConnectEvent;
|
import net.ME1312.SubServers.Client.Bukkit.Event.SubNetworkConnectEvent;
|
||||||
@ -15,7 +14,6 @@ import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
@ -50,6 +48,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
||||||
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
||||||
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
||||||
|
instance.registerPacket(0x0018, PacketCheckPermissionResponse.class);
|
||||||
|
|
||||||
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
||||||
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo());
|
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo());
|
||||||
@ -59,6 +58,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, new PacketDownloadServerInfo());
|
instance.registerPacket(0x0015, new PacketDownloadServerInfo());
|
||||||
instance.registerPacket(0x0016, new PacketDownloadPlayerList());
|
instance.registerPacket(0x0016, new PacketDownloadPlayerList());
|
||||||
instance.registerPacket(0x0017, new PacketCheckPermission());
|
instance.registerPacket(0x0017, new PacketCheckPermission());
|
||||||
|
instance.registerPacket(0x0018, new PacketCheckPermissionResponse());
|
||||||
|
|
||||||
|
|
||||||
// 30-4F: Control Packets
|
// 30-4F: Control Packets
|
||||||
@ -89,12 +89,10 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
//instance.registerPacket(0x0070, PacketInExRunEvent.class);
|
//instance.registerPacket(0x0070, PacketInExRunEvent.class);
|
||||||
//instance.registerPacket(0x0071, PacketInExReset.class);
|
//instance.registerPacket(0x0071, PacketInExReset.class);
|
||||||
//instance.registerPacket(0x0072, PacketInExReload.class);
|
//instance.registerPacket(0x0072, PacketInExReload.class);
|
||||||
instance.registerPacket(0x0074, PacketExCheckPermission.class);
|
|
||||||
|
|
||||||
instance.registerPacket(0x0070, new PacketInExRunEvent(plugin));
|
instance.registerPacket(0x0070, new PacketInExRunEvent(plugin));
|
||||||
instance.registerPacket(0x0071, new PacketInExReset());
|
instance.registerPacket(0x0071, new PacketInExReset());
|
||||||
instance.registerPacket(0x0072, new PacketInExReload(plugin));
|
instance.registerPacket(0x0072, new PacketInExReload(plugin));
|
||||||
instance.registerPacket(0x0074, new PacketExCheckPermission());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
@ -164,12 +162,11 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
subdata.on.closed(client -> {
|
subdata.on.closed(client -> {
|
||||||
SubNetworkDisconnectEvent event = new SubNetworkDisconnectEvent(client.get(), client.name());
|
SubNetworkDisconnectEvent event = new SubNetworkDisconnectEvent(client.get(), client.name());
|
||||||
if (plugin.isEnabled()) Bukkit.getPluginManager().callEvent(event);
|
if (plugin.isEnabled()) Bukkit.getPluginManager().callEvent(event);
|
||||||
map.put(0, null);
|
|
||||||
|
|
||||||
if (plugin.isEnabled()) {
|
if (plugin.isEnabled()) {
|
||||||
Bukkit.getLogger().info("SubData > Attempting reconnect in " + plugin.config.get().getMap("Settings").getMap("SubData").getInt("Reconnect", 30) + " seconds");
|
Bukkit.getLogger().info("SubData > Attempting reconnect in " + plugin.config.get().getMap("Settings").getMap("SubData").getInt("Reconnect", 30) + " seconds");
|
||||||
Util.isException(() -> Util.reflect(SubPlugin.class.getDeclaredMethod("connect", NamedContainer.class), plugin, client));
|
Util.isException(() -> Util.reflect(SubPlugin.class.getDeclaredMethod("connect", NamedContainer.class), plugin, client));
|
||||||
}
|
} else map.put(0, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
return subdata;
|
return subdata;
|
||||||
|
@ -182,10 +182,14 @@ public final class SubPlugin extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (reset == resetDate && subdata.getOrDefault(0, null) == null)
|
if (reset == resetDate && subdata.getOrDefault(0, null) == null) {
|
||||||
subdata.put(0, subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
SubDataClient open = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
||||||
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1])));
|
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||||
|
|
||||||
|
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||||
|
subdata.put(0, open);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Bukkit.getLogger().info("SubData > Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
Bukkit.getLogger().info("SubData > Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.SubData</groupId>
|
<groupId>net.ME1312.SubData</groupId>
|
||||||
<artifactId>Client</artifactId>
|
<artifactId>Client</artifactId>
|
||||||
<version>19w39a</version>
|
<version>19w42c</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketAddServer;
|
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketAddServer;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDeleteServer;
|
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDeleteServer;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadHostInfo;
|
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadHostInfo;
|
||||||
@ -61,16 +64,16 @@ public class Host {
|
|||||||
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
if (raw.contains("subdata")) {
|
if (raw.contains("subdata")) {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
} else {
|
} else {
|
||||||
return new UUID[0];
|
return new SubDataSender[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadProxyInfo;
|
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadProxyInfo;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
||||||
|
|
||||||
@ -47,13 +50,13 @@ public class Proxy {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,10 @@ package net.ME1312.SubServers.Client.Sponge.Network.API;
|
|||||||
|
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadServerInfo;
|
import net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketDownloadServerInfo;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
||||||
|
|
||||||
@ -46,13 +49,13 @@ public class Server {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -100,7 +100,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -111,7 +111,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,19 @@ package net.ME1312.SubServers.Client.Sponge.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Check Permission
|
* Check Permission Packet
|
||||||
*/
|
*/
|
||||||
public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
public class PacketCheckPermission implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
private static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
||||||
private String name;
|
|
||||||
private UUID player;
|
private UUID player;
|
||||||
private String permission;
|
private String permission;
|
||||||
private UUID tracker;
|
private UUID tracker;
|
||||||
@ -34,20 +34,6 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
*/
|
*/
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
||||||
this(null, player, permission, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketCheckPermission (Out)
|
|
||||||
*
|
|
||||||
* @param server Server to check on
|
|
||||||
* @param player Player to check on
|
|
||||||
* @param permission Permission to check
|
|
||||||
* @param callback Callbacks
|
|
||||||
*/
|
|
||||||
@SafeVarargs
|
|
||||||
public PacketCheckPermission(String server, UUID player, String permission, Callback<Boolean>... callback) {
|
|
||||||
this.name = server;
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
||||||
@ -55,19 +41,17 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, player);
|
data.set(0x0001, player);
|
||||||
data.set(0x0002, permission);
|
data.set(0x0002, permission);
|
||||||
if (name != null) data.set(0x0003, name);
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package net.ME1312.SubServers.Client.Sponge.Network.Packet;
|
||||||
|
|
||||||
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static net.ME1312.SubServers.Client.Sponge.Network.Packet.PacketCheckPermission.callbacks;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Permission Response Packet
|
||||||
|
*/
|
||||||
|
public class PacketCheckPermissionResponse implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
|
private boolean result;
|
||||||
|
private UUID tracker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (In)
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (Out)
|
||||||
|
*
|
||||||
|
* @param player Player to check on
|
||||||
|
* @param permission Permission to check
|
||||||
|
* @param tracker Receiver ID
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse(UUID player, String permission, UUID tracker) {
|
||||||
|
this.result = Util.getDespiteException(() -> Sponge.getServer().getPlayer(player).get().hasPermission(permission), false);
|
||||||
|
this.tracker = tracker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
|
data.set(0x0000, tracker);
|
||||||
|
data.set(0x0001, result);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
|
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
||||||
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int version() {
|
||||||
|
return 0x0001;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -44,7 +44,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -54,7 +54,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Graphic.UIRenderer;
|
import net.ME1312.SubServers.Client.Sponge.Graphic.UIRenderer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -109,7 +109,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -123,7 +123,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -45,7 +45,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -56,7 +56,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -34,8 +35,8 @@ public class PacketDownloadLang implements PacketObjectIn<Integer>, PacketOut {
|
|||||||
public PacketDownloadLang() {}
|
public PacketDownloadLang() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
try {
|
try {
|
||||||
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
||||||
log.info("Lang Settings Downloaded");
|
log.info("Lang Settings Downloaded");
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,7 +30,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
return data;
|
return data;
|
||||||
@ -38,7 +38,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -31,7 +31,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
return json;
|
return json;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.NamedContainer;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -40,7 +40,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (proxy != null) json.set(0x0001, proxy);
|
if (proxy != null) json.set(0x0001, proxy);
|
||||||
@ -49,7 +49,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (server != null) json.set(0x0001, server);
|
if (server != null) json.set(0x0001, server);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -47,7 +47,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -58,7 +58,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package net.ME1312.SubServers.Client.Sponge.Network.Packet;
|
|
||||||
|
|
||||||
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.PacketObjectOut;
|
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
|
||||||
import org.spongepowered.api.Sponge;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* External Check Permission Packet
|
|
||||||
*/
|
|
||||||
public class PacketExCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
|
||||||
private UUID player;
|
|
||||||
private String permission;
|
|
||||||
private UUID tracker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketExCheckPermission (In)
|
|
||||||
*/
|
|
||||||
public PacketExCheckPermission() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketExCheckPermission (Out)
|
|
||||||
*
|
|
||||||
* @param player Player to check on
|
|
||||||
* @param permission Permission to check
|
|
||||||
* @param tracker Receiver ID
|
|
||||||
*/
|
|
||||||
public PacketExCheckPermission(UUID player, String permission, UUID tracker) {
|
|
||||||
this.player = player;
|
|
||||||
this.permission = permission;
|
|
||||||
this.tracker = tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
|
||||||
@Override
|
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
|
||||||
data.set(0x0000, tracker);
|
|
||||||
data.set(0x0001, Util.getDespiteException(() -> Sponge.getServer().getPlayer(player).get().hasPermission(permission), false));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
|
||||||
client.sendPacket(new PacketExCheckPermission(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int version() {
|
|
||||||
return 0x0001;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,6 +4,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
@ -25,8 +26,8 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
||||||
else log.warning("Received request for a plugin reload");
|
else log.warning("Received request for a plugin reload");
|
||||||
Sponge.getScheduler().createTaskBuilder().async().execute(() -> {
|
Sponge.getScheduler().createTaskBuilder().async().execute(() -> {
|
||||||
|
@ -4,6 +4,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -14,8 +15,8 @@ import java.util.logging.Logger;
|
|||||||
public class PacketInExReset implements PacketObjectIn<Integer> {
|
public class PacketInExReset implements PacketObjectIn<Integer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
if (data != null && data.contains(0x0000)) log.warning("Received shutdown signal: " + data.getString(0x0000));
|
if (data != null && data.contains(0x0000)) log.warning("Received shutdown signal: " + data.getString(0x0000));
|
||||||
else log.warning("Received shutdown signal");
|
else log.warning("Received shutdown signal");
|
||||||
Sponge.getServer().shutdown();
|
Sponge.getServer().shutdown();
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Event.*;
|
import net.ME1312.SubServers.Client.Sponge.Event.*;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
@ -121,7 +121,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
||||||
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
||||||
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
||||||
|
@ -6,6 +6,7 @@ import net.ME1312.SubData.Client.Protocol.Initial.InitialPacket;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
if (plugin.api.getName() != null) json.set(0x0000, plugin.api.getName());
|
if (plugin.api.getName() != null) json.set(0x0000, plugin.api.getName());
|
||||||
if (plugin.game.getServer().getBoundAddress().isPresent()) json.set(0x0001, plugin.game.getServer().getBoundAddress().get());
|
if (plugin.game.getServer().getBoundAddress().isPresent()) json.set(0x0001, plugin.game.getServer().getBoundAddress().get());
|
||||||
@ -49,13 +50,13 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
||||||
if (data.getInt(0x0001) == 0) {
|
if (data.getInt(0x0001) == 0) {
|
||||||
try {
|
try {
|
||||||
if (data.contains(0x0000)) {
|
if (data.contains(0x0000)) {
|
||||||
Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||||
setReady(client, true);
|
setReady(client.getConnection(), true);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -43,7 +43,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -53,7 +53,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -41,7 +41,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -50,7 +50,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -41,7 +41,7 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -50,7 +50,7 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -44,7 +44,7 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, id);
|
data.set(0x0000, id);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -54,7 +54,7 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -61,7 +61,7 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -72,7 +72,7 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Library.DisconnectReason;
|
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
import net.ME1312.SubData.Client.SubDataProtocol;
|
import net.ME1312.SubData.Client.SubDataProtocol;
|
||||||
import net.ME1312.SubServers.Client.Sponge.Event.SubNetworkConnectEvent;
|
import net.ME1312.SubServers.Client.Sponge.Event.SubNetworkConnectEvent;
|
||||||
@ -13,15 +12,11 @@ import net.ME1312.SubServers.Client.Sponge.Network.Packet.*;
|
|||||||
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
import net.ME1312.SubServers.Client.Sponge.SubAPI;
|
||||||
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
import net.ME1312.SubServers.Client.Sponge.SubPlugin;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.spongepowered.api.GameState;
|
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -57,6 +52,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
instance.registerPacket(0x0015, PacketDownloadServerInfo.class);
|
||||||
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
instance.registerPacket(0x0016, PacketDownloadPlayerList.class);
|
||||||
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
instance.registerPacket(0x0017, PacketCheckPermission.class);
|
||||||
|
instance.registerPacket(0x0018, PacketCheckPermissionResponse.class);
|
||||||
|
|
||||||
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
instance.registerPacket(0x0010, new PacketDownloadLang(plugin));
|
||||||
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo());
|
instance.registerPacket(0x0011, new PacketDownloadPlatformInfo());
|
||||||
@ -66,6 +62,7 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
instance.registerPacket(0x0015, new PacketDownloadServerInfo());
|
instance.registerPacket(0x0015, new PacketDownloadServerInfo());
|
||||||
instance.registerPacket(0x0016, new PacketDownloadPlayerList());
|
instance.registerPacket(0x0016, new PacketDownloadPlayerList());
|
||||||
instance.registerPacket(0x0017, new PacketCheckPermission());
|
instance.registerPacket(0x0017, new PacketCheckPermission());
|
||||||
|
instance.registerPacket(0x0018, new PacketCheckPermissionResponse());
|
||||||
|
|
||||||
|
|
||||||
// 30-4F: Control Packets
|
// 30-4F: Control Packets
|
||||||
@ -96,12 +93,10 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
//instance.registerPacket(0x0070, PacketInExRunEvent.class);
|
//instance.registerPacket(0x0070, PacketInExRunEvent.class);
|
||||||
//instance.registerPacket(0x0071, PacketInExReset.class);
|
//instance.registerPacket(0x0071, PacketInExReset.class);
|
||||||
//instance.registerPacket(0x0072, PacketInExReload.class);
|
//instance.registerPacket(0x0072, PacketInExReload.class);
|
||||||
instance.registerPacket(0x0074, PacketExCheckPermission.class);
|
|
||||||
|
|
||||||
instance.registerPacket(0x0070, new PacketInExRunEvent(plugin));
|
instance.registerPacket(0x0070, new PacketInExRunEvent(plugin));
|
||||||
instance.registerPacket(0x0071, new PacketInExReset());
|
instance.registerPacket(0x0071, new PacketInExReset());
|
||||||
instance.registerPacket(0x0072, new PacketInExReload(plugin));
|
instance.registerPacket(0x0072, new PacketInExReload(plugin));
|
||||||
instance.registerPacket(0x0074, new PacketExCheckPermission());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
@ -175,13 +170,12 @@ public class SubProtocol extends SubDataProtocol {
|
|||||||
subdata.on.closed(client -> {
|
subdata.on.closed(client -> {
|
||||||
SubNetworkDisconnectEvent event = new SubNetworkDisconnectEvent(client.get(), client.name());
|
SubNetworkDisconnectEvent event = new SubNetworkDisconnectEvent(client.get(), client.name());
|
||||||
Sponge.getEventManager().post(event);
|
Sponge.getEventManager().post(event);
|
||||||
map.put(0, null);
|
|
||||||
|
|
||||||
if (Util.getDespiteException(() -> Util.reflect(SubPlugin.class.getDeclaredField("running"), plugin), true)) {
|
if (Util.getDespiteException(() -> Util.reflect(SubPlugin.class.getDeclaredField("running"), plugin), true)) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.get()), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.get()), null);
|
||||||
log.info("Attempting reconnect in " + plugin.config.get().getMap("Settings").getMap("SubData").getInt("Reconnect", 30) + " seconds");
|
log.info("Attempting reconnect in " + plugin.config.get().getMap("Settings").getMap("SubData").getInt("Reconnect", 30) + " seconds");
|
||||||
Util.isException(() -> Util.reflect(SubPlugin.class.getDeclaredMethod("connect", NamedContainer.class), plugin, client));
|
Util.isException(() -> Util.reflect(SubPlugin.class.getDeclaredMethod("connect", NamedContainer.class), plugin, client));
|
||||||
}
|
} else map.put(0, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
return subdata;
|
return subdata;
|
||||||
|
@ -201,10 +201,14 @@ public final class SubPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (reset == resetDate && subdata.getOrDefault(0, null) == null)
|
if (reset == resetDate && subdata.getOrDefault(0, null) == null) {
|
||||||
subdata.put(0, subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
SubDataClient open = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
||||||
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1])));
|
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||||
|
|
||||||
|
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||||
|
subdata.put(0, open);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info("Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
log.info("Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.SubData</groupId>
|
<groupId>net.ME1312.SubData</groupId>
|
||||||
<artifactId>Client</artifactId>
|
<artifactId>Client</artifactId>
|
||||||
<version>19w39a</version>
|
<version>19w42c</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -299,10 +299,14 @@ public final class ExHost {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (reset == resetDate && subdata.getOrDefault(0, null) == null)
|
if (reset == resetDate && subdata.getOrDefault(0, null) == null) {
|
||||||
subdata.put(0, subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
SubDataClient open = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
||||||
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1])));
|
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||||
|
|
||||||
|
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||||
|
subdata.put(0, open);
|
||||||
|
}
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info("Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
log.info("Connection was unsuccessful, retrying in " + reconnect + " seconds");
|
||||||
|
@ -76,7 +76,7 @@ public class SubLoggerImpl {
|
|||||||
Process process = this.process;
|
Process process = this.process;
|
||||||
ExHost host = SubAPI.getInstance().getInternals();
|
ExHost host = SubAPI.getInstance().getInternals();
|
||||||
if (logn) Util.isException(() -> {
|
if (logn) Util.isException(() -> {
|
||||||
channel = (SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0].newChannel();
|
channel = (SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0].openChannel();
|
||||||
channel.on.closed(new Callback<NamedContainer<DisconnectReason, DataClient>>() {
|
channel.on.closed(new Callback<NamedContainer<DisconnectReason, DataClient>>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(NamedContainer<DisconnectReason, DataClient> client) {
|
public void run(NamedContainer<DisconnectReason, DataClient> client) {
|
||||||
@ -93,8 +93,10 @@ public class SubLoggerImpl {
|
|||||||
if (!started || SubLoggerImpl.this.process == null || process != SubLoggerImpl.this.process || !process.isAlive()) {
|
if (!started || SubLoggerImpl.this.process == null || process != SubLoggerImpl.this.process || !process.isAlive()) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
} else try {
|
} else try {
|
||||||
channel = (SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0].newChannel();
|
SubDataClient open = (SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0].openChannel();
|
||||||
channel.on.closed(run);
|
open.on.closed(run);
|
||||||
|
channel.reconnect(channel);
|
||||||
|
channel = open;
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
} catch (NullPointerException | IOException e) {}
|
} catch (NullPointerException | IOException e) {}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Network.Packet.PacketAddServer;
|
import net.ME1312.SubServers.Host.Network.Packet.PacketAddServer;
|
||||||
import net.ME1312.SubServers.Host.Network.Packet.PacketDeleteServer;
|
import net.ME1312.SubServers.Host.Network.Packet.PacketDeleteServer;
|
||||||
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadHostInfo;
|
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadHostInfo;
|
||||||
@ -61,16 +64,16 @@ public class Host {
|
|||||||
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
* @return SubData Client Channel ID Array (may be empty if unsupported)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
if (raw.contains("subdata")) {
|
if (raw.contains("subdata")) {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
} else {
|
} else {
|
||||||
return new UUID[0];
|
return new SubDataSender[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadProxyInfo;
|
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadProxyInfo;
|
||||||
import net.ME1312.SubServers.Host.SubAPI;
|
import net.ME1312.SubServers.Host.SubAPI;
|
||||||
|
|
||||||
@ -47,13 +50,13 @@ public class Proxy {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,10 @@ package net.ME1312.SubServers.Host.Network.API;
|
|||||||
|
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
|
import net.ME1312.SubData.Client.DataSender;
|
||||||
|
import net.ME1312.SubData.Client.Library.ForwardedDataSender;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadServerInfo;
|
import net.ME1312.SubServers.Host.Network.Packet.PacketDownloadServerInfo;
|
||||||
import net.ME1312.SubServers.Host.SubAPI;
|
import net.ME1312.SubServers.Host.SubAPI;
|
||||||
|
|
||||||
@ -46,13 +49,13 @@ public class Server {
|
|||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UUID[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
||||||
LinkedList<UUID> channels = new LinkedList<UUID>();
|
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.getUUID(channel));
|
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
||||||
return channels.toArray(new UUID[0]);
|
return channels.toArray(new SubDataSender[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -100,7 +100,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -111,7 +111,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,19 @@ package net.ME1312.SubServers.Host.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Callback.Callback;
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Check Permission
|
* Check Permission Packet
|
||||||
*/
|
*/
|
||||||
public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
public class PacketCheckPermission implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
private static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
static HashMap<UUID, Callback<Boolean>[]> callbacks = new HashMap<UUID, Callback<Boolean>[]>();
|
||||||
private String name;
|
|
||||||
private UUID player;
|
private UUID player;
|
||||||
private String permission;
|
private String permission;
|
||||||
private UUID tracker;
|
private UUID tracker;
|
||||||
@ -34,20 +34,6 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
*/
|
*/
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
public PacketCheckPermission(UUID player, String permission, Callback<Boolean>... callback) {
|
||||||
this(null, player, permission, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New PacketCheckPermission (Out)
|
|
||||||
*
|
|
||||||
* @param server Server to check on
|
|
||||||
* @param player Player to check on
|
|
||||||
* @param permission Permission to check
|
|
||||||
* @param callback Callbacks
|
|
||||||
*/
|
|
||||||
@SafeVarargs
|
|
||||||
public PacketCheckPermission(String server, UUID player, String permission, Callback<Boolean>... callback) {
|
|
||||||
this.name = server;
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
this.tracker = Util.getNew(callbacks.keySet(), UUID::randomUUID);
|
||||||
@ -55,19 +41,17 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Throwable {
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, player);
|
data.set(0x0001, player);
|
||||||
data.set(0x0002, permission);
|
data.set(0x0002, permission);
|
||||||
if (name != null) data.set(0x0003, name);
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package net.ME1312.SubServers.Host.Network.Packet;
|
||||||
|
|
||||||
|
import net.ME1312.Galaxi.Library.Callback.Callback;
|
||||||
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.Forwardable;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static net.ME1312.SubServers.Host.Network.Packet.PacketCheckPermission.callbacks;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Permission Response Packet
|
||||||
|
*/
|
||||||
|
public class PacketCheckPermissionResponse implements Forwardable, PacketObjectIn<Integer>, PacketObjectOut<Integer> {
|
||||||
|
private boolean result;
|
||||||
|
private UUID tracker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (In)
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New PacketCheckPermissionResponse (Out)
|
||||||
|
*
|
||||||
|
* @param player Player to check on
|
||||||
|
* @param permission Permission to check
|
||||||
|
* @param tracker Receiver ID
|
||||||
|
*/
|
||||||
|
public PacketCheckPermissionResponse(UUID player, String permission, UUID tracker) {
|
||||||
|
this.result = false; // TODO
|
||||||
|
this.tracker = tracker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectMap<Integer> send(SubDataSender client) throws Throwable {
|
||||||
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
|
data.set(0x0000, tracker);
|
||||||
|
data.set(0x0001, result);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
|
for (Callback<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data.getBoolean(0x0001));
|
||||||
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int version() {
|
||||||
|
return 0x0001;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -44,7 +44,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -54,7 +54,7 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -73,7 +73,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, name);
|
data.set(0x0001, name);
|
||||||
@ -87,7 +87,7 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -45,7 +45,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -56,7 +56,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (group != null) json.set(0x0001, group);
|
if (group != null) json.set(0x0001, group);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -33,8 +34,8 @@ public class PacketDownloadLang implements PacketObjectIn<Integer>, PacketOut {
|
|||||||
public PacketDownloadLang() {}
|
public PacketDownloadLang() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
try {
|
try {
|
||||||
Util.reflect(ExHost.class.getDeclaredField("lang"), host, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
Util.reflect(ExHost.class.getDeclaredField("lang"), host, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
|
||||||
log.info("Lang Settings Downloaded");
|
log.info("Lang Settings Downloaded");
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,7 +30,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
return data;
|
return data;
|
||||||
@ -38,7 +38,7 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -31,7 +31,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
return json;
|
return json;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadPlayerList implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.NamedContainer;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -40,7 +40,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (proxy != null) json.set(0x0001, proxy);
|
if (proxy != null) json.set(0x0001, proxy);
|
||||||
@ -49,7 +49,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
boolean mode = callbacks.get(data.getUUID(0x0000)).name();
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000)).get()) {
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +39,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
ObjectMap<Integer> json = new ObjectMap<Integer>();
|
||||||
json.set(0x0000, tracker);
|
json.set(0x0000, tracker);
|
||||||
if (server != null) json.set(0x0001, server);
|
if (server != null) json.set(0x0001, server);
|
||||||
@ -48,7 +48,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
for (Callback<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -47,7 +47,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -58,7 +58,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
if (tracker != null) data.set(0x0000, tracker);
|
if (tracker != null) data.set(0x0000, tracker);
|
||||||
data.set(0x0001, response);
|
data.set(0x0001, response);
|
||||||
@ -64,8 +65,8 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger logger = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger logger = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||||
try {
|
try {
|
||||||
String name = data.getRawString(0x0001);
|
String name = data.getRawString(0x0001);
|
||||||
@ -93,10 +94,10 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
|
|||||||
if (UPnP.isUPnPAvailable() && UPnP.isMappedTCP(server.getPort()))
|
if (UPnP.isUPnPAvailable() && UPnP.isMappedTCP(server.getPort()))
|
||||||
UPnP.closePortTCP(server.getPort());
|
UPnP.closePortTCP(server.getPort());
|
||||||
|
|
||||||
init(client, server = new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger);
|
init(client.getConnection(), server = new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
init(client, new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger);
|
init(client.getConnection(), new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
client.sendPacket(new PacketExAddServer(2, tracker));
|
client.sendPacket(new PacketExAddServer(2, tracker));
|
||||||
|
@ -6,7 +6,7 @@ import net.ME1312.Galaxi.Library.UniversalFile;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Executable.SubCreatorImpl;
|
import net.ME1312.SubServers.Host.Executable.SubCreatorImpl;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
@ -27,14 +27,14 @@ public class PacketExConfigureHost implements PacketObjectIn<Integer>, PacketOut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sending(SubDataClient client) {
|
public void sending(SubDataSender client) {
|
||||||
host.log.info.println("Downloading Host Settings...");
|
host.log.info.println("Downloading Host Settings...");
|
||||||
first = true;
|
first = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
host.host = new ObjectMap<>((Map<String, ?>) data.getObject(0x0000));
|
host.host = new ObjectMap<>((Map<String, ?>) data.getObject(0x0000));
|
||||||
for (SubCreatorImpl.ServerTemplate template : host.templates.values()) {
|
for (SubCreatorImpl.ServerTemplate template : host.templates.values()) {
|
||||||
Util.deleteDirectory(template.getDirectory());
|
Util.deleteDirectory(template.getDirectory());
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -64,7 +64,7 @@ public class PacketExCreateServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
if (tracker != null) data.set(0x0000, tracker);
|
if (tracker != null) data.set(0x0000, tracker);
|
||||||
data.set(0x0001, response);
|
data.set(0x0001, response);
|
||||||
@ -75,7 +75,7 @@ public class PacketExCreateServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||||
try {
|
try {
|
||||||
if (data.contains(0x0001)) {
|
if (data.contains(0x0001)) {
|
||||||
|
@ -9,6 +9,7 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
import net.ME1312.SubServers.Host.SubAPI;
|
import net.ME1312.SubServers.Host.SubAPI;
|
||||||
@ -50,7 +51,7 @@ public class PacketExDeleteServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
if (tracker != null) data.set(0x0000, tracker);
|
if (tracker != null) data.set(0x0000, tracker);
|
||||||
data.set(0x0001, response);
|
data.set(0x0001, response);
|
||||||
@ -59,8 +60,8 @@ public class PacketExDeleteServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||||
try {
|
try {
|
||||||
String name = data.getRawString(0x0001);
|
String name = data.getRawString(0x0001);
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.UniversalFile;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
import net.ME1312.SubData.Client.Protocol.PacketOut;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketStreamIn;
|
import net.ME1312.SubData.Client.Protocol.PacketStreamIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
import net.ME1312.SubServers.Host.SubAPI;
|
import net.ME1312.SubServers.Host.SubAPI;
|
||||||
|
|
||||||
@ -25,14 +25,14 @@ public class PacketExDownloadTemplates implements PacketOut, PacketStreamIn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sending(SubDataClient client) throws Throwable {
|
public void sending(SubDataSender client) throws Throwable {
|
||||||
UniversalFile dir = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Templates");
|
UniversalFile dir = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Templates");
|
||||||
if (dir.exists()) Util.deleteDirectory(dir);
|
if (dir.exists()) Util.deleteDirectory(dir);
|
||||||
host.log.info.println("Downloading Template Files...");
|
host.log.info.println("Downloading Template Files...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, InputStream stream) {
|
public void receive(SubDataSender client, InputStream stream) {
|
||||||
try {
|
try {
|
||||||
Util.unzip(stream, new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Templates"));
|
Util.unzip(stream, new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Templates"));
|
||||||
host.log.info.println("Template Files Downloaded");
|
host.log.info.println("Template Files Downloaded");
|
||||||
|
@ -4,7 +4,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Executable.SubLoggerImpl;
|
import net.ME1312.SubServers.Host.Executable.SubLoggerImpl;
|
||||||
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
import net.ME1312.SubServers.Host.Executable.SubServerImpl;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
@ -69,7 +69,7 @@ public class PacketExEditServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, server.getName());
|
data.set(0x0000, server.getName());
|
||||||
data.set(0x0001, type.getValue());
|
data.set(0x0001, type.getValue());
|
||||||
@ -78,7 +78,7 @@ public class PacketExEditServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
try {
|
try {
|
||||||
SubServerImpl server = host.servers.get(data.getString(0x0000).toLowerCase());
|
SubServerImpl server = host.servers.get(data.getString(0x0000).toLowerCase());
|
||||||
switch (data.getInt(0x0001)) {
|
switch (data.getInt(0x0001)) {
|
||||||
|
@ -6,6 +6,8 @@ import net.ME1312.Galaxi.Library.Util;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
import net.ME1312.SubServers.Host.SubAPI;
|
import net.ME1312.SubServers.Host.SubAPI;
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ public class PacketExRemoveServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
if (tracker != null) data.set(0x0000, tracker);
|
if (tracker != null) data.set(0x0000, tracker);
|
||||||
data.set(0x0001, response);
|
data.set(0x0001, response);
|
||||||
@ -51,8 +53,8 @@ public class PacketExRemoveServer implements PacketObjectIn<Integer>, PacketObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||||
try {
|
try {
|
||||||
String name = data.getRawString(0x0001);
|
String name = data.getRawString(0x0001);
|
||||||
|
@ -4,6 +4,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -24,8 +25,8 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
||||||
else log.warning("Received request for a plugin reload");
|
else log.warning("Received request for a plugin reload");
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
@ -2,7 +2,7 @@ package net.ME1312.SubServers.Host.Network.Packet;
|
|||||||
|
|
||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,7 +16,7 @@ public class PacketInExReset implements PacketObjectIn<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {/*
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {/*
|
||||||
List<String> subservers = new ArrayList<String>();
|
List<String> subservers = new ArrayList<String>();
|
||||||
subservers.addAll(host.servers.keySet());
|
subservers.addAll(host.servers.keySet());
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Callback.Callback;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.Event.*;
|
import net.ME1312.SubServers.Host.Event.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -119,7 +119,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
if (callbacks.keySet().contains(data.getString(0x0000))) {
|
||||||
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
List<Callback<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
|
||||||
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
|
||||||
|
@ -8,6 +8,7 @@ import net.ME1312.SubData.Client.Protocol.Initial.InitialPacket;
|
|||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataClient;
|
||||||
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
import net.ME1312.SubServers.Host.ExHost;
|
import net.ME1312.SubServers.Host.ExHost;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -41,7 +42,7 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, host.api.getName());
|
data.set(0x0000, host.api.getName());
|
||||||
data.set(0x0001, channel);
|
data.set(0x0001, channel);
|
||||||
@ -49,10 +50,10 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client), null);
|
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||||
if (data.getInt(0x0001) == 0) {
|
if (data.getInt(0x0001) == 0) {
|
||||||
setReady(client, true);
|
setReady(client.getConnection(), true);
|
||||||
} else {
|
} else {
|
||||||
log.severe("Could not link name with host" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
log.severe("Could not link name with host" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||||
DebugUtil.logException(new IllegalStateException(), log);
|
DebugUtil.logException(new IllegalStateException(), log);
|
||||||
|
@ -3,7 +3,7 @@ package net.ME1312.SubServers.Host.Network.Packet;
|
|||||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||||
import net.ME1312.Galaxi.Library.Version.Version;
|
import net.ME1312.Galaxi.Library.Version.Version;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ public class PacketOutExLogMessage implements PacketObjectOut<Integer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) throws Exception {
|
public ObjectMap<Integer> send(SubDataSender client) throws Exception {
|
||||||
if (terminate) client.close();
|
if (terminate) client.getConnection().close();
|
||||||
|
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, address);
|
data.set(0x0000, address);
|
||||||
|
@ -10,8 +10,7 @@ public class PacketOutExRequestQueue implements PacketOut {
|
|||||||
/**
|
/**
|
||||||
* New PacketOutExRequestQueue
|
* New PacketOutExRequestQueue
|
||||||
*/
|
*/
|
||||||
public PacketOutExRequestQueue() {
|
public PacketOutExRequestQueue() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -43,7 +43,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -53,7 +53,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
|||||||
import net.ME1312.Galaxi.Library.Util;
|
import net.ME1312.Galaxi.Library.Util;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
|
||||||
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
|
||||||
import net.ME1312.SubData.Client.SubDataClient;
|
import net.ME1312.SubData.Client.SubDataSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -41,7 +41,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectMap<Integer> send(SubDataClient client) {
|
public ObjectMap<Integer> send(SubDataSender client) {
|
||||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||||
data.set(0x0000, tracker);
|
data.set(0x0000, tracker);
|
||||||
data.set(0x0001, server);
|
data.set(0x0001, server);
|
||||||
@ -50,7 +50,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||||
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
for (Callback<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.run(data);
|
||||||
callbacks.remove(data.getUUID(0x0000));
|
callbacks.remove(data.getUUID(0x0000));
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user