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 ");
}
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();
}
}
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);
}
}
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));
}
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);
}
}
Aggregations