Search in sources :

Example 1 with CloudPlayer

use of de.dytanic.cloudnet.lib.player.CloudPlayer in project CloudNet by Dytanic.

the class CommandList method onExecuteCommand.

@Override
public void onExecuteCommand(CommandSender sender, String[] args) {
    sender.sendMessage("CloudNet: ");
    int memory = 0, maxMemory = 0;
    for (Wrapper wrapper : CloudNet.getInstance().getWrappers().values()) {
        memory += wrapper.getUsedMemory();
        maxMemory += wrapper.getMaxMemory();
        sender.sendMessage("Wrapper: [" + wrapper.getServerId() + "] @" + wrapper.getNetworkInfo().getHostName());
        sender.sendMessage("Info: CPU Usage: " + NetworkUtils.DECIMAL_FORMAT.format(wrapper.getCpuUsage()) + "/100% | Memory: " + wrapper.getUsedMemory() + NetworkUtils.SLASH_STRING + wrapper.getMaxMemory() + "MB");
        sender.sendMessage(" ", "Proxys:");
        for (ProxyServer proxyServer : wrapper.getProxys().values()) {
            sender.sendMessage("Proxy [" + proxyServer.getServerId() + "] @" + proxyServer.getNetworkInfo().getHostName() + " | " + proxyServer.getProxyInfo().getOnlineCount() + NetworkUtils.SLASH_STRING + CloudNet.getInstance().getProxyGroups().get(proxyServer.getProxyInfo().getServiceId().getGroup()).getProxyConfig().getMaxPlayers() + " | State: " + (proxyServer.getChannel() != null ? "connected" : "not connected"));
        }
        sender.sendMessage(" ", "Servers:");
        for (MinecraftServer proxyServer : wrapper.getServers().values()) {
            sender.sendMessage("Server [" + proxyServer.getServerId() + "] @" + proxyServer.getServerInfo().getHost() + " | " + proxyServer.getServerInfo().getOnlineCount() + NetworkUtils.SLASH_STRING + proxyServer.getServerInfo().getMaxPlayers() + " | State: " + (proxyServer.getChannel() != null ? "connected" : "not connected"));
        }
        sender.sendMessage(" ");
    }
    for (CloudPlayer cloudPlayer : CloudNet.getInstance().getNetworkManager().getOnlinePlayers().values()) {
        sender.sendMessage("* " + cloudPlayer.getUniqueId() + "#" + cloudPlayer.getName() + " - " + cloudPlayer.getProxy() + ":" + cloudPlayer.getServer());
    }
    sender.sendMessage(" ");
    sender.sendMessage("CloudNet uses " + memory + NetworkUtils.SLASH_STRING + maxMemory + "MB ");
}
Also used : Wrapper(de.dytanic.cloudnetcore.network.components.Wrapper) CloudPlayer(de.dytanic.cloudnet.lib.player.CloudPlayer) ProxyServer(de.dytanic.cloudnetcore.network.components.ProxyServer) MinecraftServer(de.dytanic.cloudnetcore.network.components.MinecraftServer)

Example 2 with CloudPlayer

use of de.dytanic.cloudnet.lib.player.CloudPlayer in project CloudNet by Dytanic.

the class NetworkManager method handleCommandExecute.

public void handleCommandExecute(PlayerCommandExecution playerCommandExecutor) {
    CloudPlayer cloudPlayer = getPlayer(playerCommandExecutor.getName());
    if (cloudPlayer != null) {
        CloudNet.getLogger().info("Player [" + playerCommandExecutor.getName() + "] executed command [" + playerCommandExecutor.getCommandLine() + "] on [" + cloudPlayer.getProxy() + NetworkUtils.SLASH_STRING + cloudPlayer.getServer() + "]");
        CloudNet.getInstance().getEventManager().callEvent(new CommandExecutionEvent(playerCommandExecutor));
        StatisticManager.getInstance().playerCommandExecutions();
    }
}
Also used : CloudPlayer(de.dytanic.cloudnet.lib.player.CloudPlayer)

Example 3 with CloudPlayer

use of de.dytanic.cloudnet.lib.player.CloudPlayer in project CloudNet by Dytanic.

the class CloudServer method getPlayerAndCache.

@Deprecated
public void getPlayerAndCache(UUID uniqueId) {
    CloudPlayer cloudPlayer = CloudAPI.getInstance().getOnlinePlayer(uniqueId);
    if (cloudPlayer != null) {
        cloudPlayer.setPlayerExecutor(new PlayerExecutorBridge());
        this.cloudPlayers.put(uniqueId, cloudPlayer);
    }
}
Also used : CloudPlayer(de.dytanic.cloudnet.lib.player.CloudPlayer) PlayerExecutorBridge(de.dytanic.cloudnet.api.player.PlayerExecutorBridge)

Example 4 with CloudPlayer

use of de.dytanic.cloudnet.lib.player.CloudPlayer in project CloudNet by Dytanic.

the class PacketInUpdatePlayer method handleInput.

@Override
public void handleInput(Document data, PacketSender packetSender) {
    OfflinePlayer offlinePlayer = data.getObject("player", new TypeToken<OfflinePlayer>() {
    }.getType());
    CloudNet.getInstance().getDbHandlers().getPlayerDatabase().updatePlayer(offlinePlayer);
    if (CloudNet.getInstance().getNetworkManager().getOnlinePlayers().containsKey(offlinePlayer.getUniqueId())) {
        CloudPlayer cloudPlayer = CloudNet.getInstance().getNetworkManager().getOnlinePlayers().get(offlinePlayer.getUniqueId());
        cloudPlayer.setMetaData(offlinePlayer.getMetaData());
        cloudPlayer.setPermissionEntity(offlinePlayer.getPermissionEntity());
        CloudNet.getInstance().getNetworkManager().handlePlayerUpdate(cloudPlayer);
    } else
        CloudNet.getInstance().getNetworkManager().sendAllUpdate(new PacketOutUpdateOfflinePlayer(offlinePlayer));
}
Also used : TypeToken(com.google.gson.reflect.TypeToken) CloudPlayer(de.dytanic.cloudnet.lib.player.CloudPlayer) PacketOutUpdateOfflinePlayer(de.dytanic.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer) OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) PacketOutUpdateOfflinePlayer(de.dytanic.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer)

Example 5 with CloudPlayer

use of de.dytanic.cloudnet.lib.player.CloudPlayer in project CloudNet by Dytanic.

the class PacketInLoginSuccess method handleInput.

@Override
public void handleInput(Document data, PacketSender packetSender) {
    UUID unique = data.getObject("uniqueId", UUID.class);
    CloudPlayer cloudPlayer = CloudNet.getInstance().getNetworkManager().getWaitingPlayers().get(unique);
    if (cloudPlayer != null) {
        CloudNet.getInstance().getNetworkManager().getWaitingPlayers().remove(unique);
        CloudNet.getInstance().getNetworkManager().getOnlinePlayers().put(cloudPlayer.getUniqueId(), cloudPlayer);
    }
}
Also used : CloudPlayer(de.dytanic.cloudnet.lib.player.CloudPlayer) UUID(java.util.UUID)

Aggregations

CloudPlayer (de.dytanic.cloudnet.lib.player.CloudPlayer)19 TypeToken (com.google.gson.reflect.TypeToken)5 Result (de.dytanic.cloudnet.lib.network.protocol.packet.result.Result)4 OfflinePlayer (de.dytanic.cloudnet.lib.player.OfflinePlayer)3 ProxyGroup (de.dytanic.cloudnet.lib.server.ProxyGroup)3 Document (de.dytanic.cloudnet.lib.utility.document.Document)3 EventHandler (net.md_5.bungee.event.EventHandler)3 PlayerConnection (de.dytanic.cloudnet.lib.player.PlayerConnection)2 GroupEntityData (de.dytanic.cloudnet.lib.player.permission.GroupEntityData)2 MinecraftServer (de.dytanic.cloudnetcore.network.components.MinecraftServer)2 ProxyServer (de.dytanic.cloudnetcore.network.components.ProxyServer)2 NetworkHandler (de.dytanic.cloudnet.api.handlers.NetworkHandler)1 PlayerExecutorBridge (de.dytanic.cloudnet.api.player.PlayerExecutorBridge)1 CloudPermissble (de.dytanic.cloudnet.bridge.internal.util.CloudPermissble)1 CloudPlayerCommandSender (de.dytanic.cloudnet.bridge.internal.util.CloudPlayerCommandSender)1 ConnectableAddress (de.dytanic.cloudnet.lib.ConnectableAddress)1 WrapperInfo (de.dytanic.cloudnet.lib.network.WrapperInfo)1 PlayerExecutor (de.dytanic.cloudnet.lib.player.PlayerExecutor)1 PermissionEntity (de.dytanic.cloudnet.lib.player.permission.PermissionEntity)1 AutoSlot (de.dytanic.cloudnet.lib.proxylayout.AutoSlot)1