mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 03:35:26 +01:00
Assign a short-hand for getting player data
/sub info u ME1312
This commit is contained in:
parent
5d3664cbc7
commit
16c373b336
@ -382,6 +382,8 @@ public final class SubCommand extends Command implements TabExecutor {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
@ -328,6 +328,8 @@ public final class SubCommand extends Command {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
@ -634,6 +634,8 @@ public final class SubCommand implements CommandExecutor {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
@ -317,6 +317,8 @@ public class SubCommand {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
@ -688,8 +688,7 @@ public final class ExProxy extends BungeeCommon implements Listener {
|
||||
|
||||
@EventHandler(priority = Byte.MIN_VALUE)
|
||||
public void remove(SubRemoveServerEvent e) {
|
||||
if (servers.keySet().contains(e.getServer().toLowerCase()))
|
||||
servers.remove(e.getServer().toLowerCase());
|
||||
if (servers.remove(e.getServer().toLowerCase()) != null)
|
||||
Logger.get("SubServers").info("Removed Server: " + e.getServer());
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import net.ME1312.Galaxi.Library.Container.Pair;
|
||||
import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||
import net.ME1312.Galaxi.Library.Util;
|
||||
import net.ME1312.Galaxi.Library.Version.Version;
|
||||
import net.ME1312.SubData.Client.Library.DataSize;
|
||||
import net.ME1312.SubData.Client.SubDataClient;
|
||||
import net.ME1312.SubData.Client.SubDataProtocol;
|
||||
import net.ME1312.SubServers.Client.Common.Network.API.RemotePlayer;
|
||||
@ -13,6 +12,7 @@ import net.ME1312.SubServers.Client.Common.Network.API.Server;
|
||||
import net.ME1312.SubServers.Client.Common.Network.Packet.*;
|
||||
import net.ME1312.SubServers.Sync.Event.SubNetworkConnectEvent;
|
||||
import net.ME1312.SubServers.Sync.Event.SubNetworkDisconnectEvent;
|
||||
import net.ME1312.SubServers.Sync.Event.SubRemoveServerEvent;
|
||||
import net.ME1312.SubServers.Sync.ExProxy;
|
||||
import net.ME1312.SubServers.Sync.Network.Packet.*;
|
||||
import net.ME1312.SubServers.Sync.Server.CachedPlayer;
|
||||
@ -192,11 +192,20 @@ public class SubProtocol extends SubDataProtocol {
|
||||
subdata.sendPacket(new PacketExSyncPlayer(null, localPlayers.toArray(new CachedPlayer[0])));
|
||||
|
||||
plugin.api.getServers(servers -> {
|
||||
HashMap<String, ServerImpl> localServers = new HashMap<String, ServerImpl>(plugin.servers);
|
||||
for (Server server : servers.values()) {
|
||||
localServers.remove(server.getName().toLowerCase());
|
||||
plugin.merge(server);
|
||||
}
|
||||
for (ServerImpl server : localServers.values()) {
|
||||
plugin.remove(new SubRemoveServerEvent(null, null, server.getName()));
|
||||
}
|
||||
|
||||
plugin.api.getRemotePlayers(players -> {
|
||||
synchronized (plugin.rPlayers) {
|
||||
plugin.rPlayerLinkS.clear();
|
||||
plugin.rPlayerLinkP.clear();
|
||||
plugin.rPlayers.clear();
|
||||
for (RemotePlayer player : players.values()) {
|
||||
plugin.rPlayerLinkP.put(player.getUniqueId(), player.getProxyName().toLowerCase());
|
||||
plugin.rPlayers.put(player.getUniqueId(), (CachedPlayer) player);
|
||||
@ -205,6 +214,7 @@ public class SubProtocol extends SubDataProtocol {
|
||||
if (server instanceof ServerImpl)
|
||||
plugin.rPlayerLinkS.put(player.getUniqueId(), (ServerImpl) server);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -322,6 +322,8 @@ public final class SubCommand extends Command implements TabExecutor {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
@ -12,6 +12,7 @@ import net.ME1312.SubServers.Client.Common.Network.API.Server;
|
||||
import net.ME1312.SubServers.Client.Common.Network.Packet.*;
|
||||
import net.ME1312.SubServers.Velocity.Event.SubNetworkConnectEvent;
|
||||
import net.ME1312.SubServers.Velocity.Event.SubNetworkDisconnectEvent;
|
||||
import net.ME1312.SubServers.Velocity.Event.SubRemoveServerEvent;
|
||||
import net.ME1312.SubServers.Velocity.ExProxy;
|
||||
import net.ME1312.SubServers.Velocity.Network.Packet.*;
|
||||
import net.ME1312.SubServers.Velocity.Server.CachedPlayer;
|
||||
@ -20,6 +21,7 @@ import net.ME1312.SubServers.Velocity.SubAPI;
|
||||
|
||||
import com.velocitypowered.api.proxy.config.ProxyConfig;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -188,11 +190,20 @@ public class SubProtocol extends SubDataProtocol {
|
||||
subdata.sendPacket(new PacketExSyncPlayer(null, localPlayers.toArray(new CachedPlayer[0])));
|
||||
|
||||
plugin.api.getServers(servers -> {
|
||||
ArrayList<ServerData> localServers = new ArrayList<ServerData>(plugin.servers.values());
|
||||
for (Server server : servers.values()) {
|
||||
ExProxy.getInstance().getServer(server.getName()).map(RegisteredServer::getServerInfo).map(plugin::getData).ifPresent(localServers::remove);
|
||||
plugin.merge(server);
|
||||
}
|
||||
for (ServerData server : localServers) {
|
||||
plugin.remove(new SubRemoveServerEvent(null, null, server.getName()));
|
||||
}
|
||||
|
||||
plugin.api.getRemotePlayers(players -> {
|
||||
synchronized (plugin.rPlayers) {
|
||||
plugin.rPlayerLinkS.clear();
|
||||
plugin.rPlayerLinkP.clear();
|
||||
plugin.rPlayers.clear();
|
||||
for (RemotePlayer player : players.values()) {
|
||||
plugin.rPlayerLinkP.put(player.getUniqueId(), player.getProxyName().toLowerCase());
|
||||
plugin.rPlayers.put(player.getUniqueId(), (CachedPlayer) player);
|
||||
@ -201,6 +212,7 @@ public class SubProtocol extends SubDataProtocol {
|
||||
plugin.rPlayerLinkS.put(player.getUniqueId(), server)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -327,6 +327,8 @@ public final class SubCommand implements SimpleCommand {
|
||||
case "subserver":
|
||||
getServer.run();
|
||||
break;
|
||||
case "u":
|
||||
case "user":
|
||||
case "player":
|
||||
getPlayer.run();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user