use of de.dytanic.cloudnet.lib.network.protocol.packet.result.Result in project CloudNet by Dytanic.
the class CloudAPI method getOnlinePlayers.
/**
* Returns all OnlinePlayers on Network
*/
public Collection<CloudPlayer> getOnlinePlayers() {
Result result = networkConnection.getPacketManager().sendQuery(new PacketAPIOutGetPlayers(), networkConnection);
Collection<CloudPlayer> cloudPlayers = result.getResult().getObject("players", new TypeToken<Collection<CloudPlayer>>() {
}.getType());
if (cloudPlayers == null)
return new ArrayList<>();
for (CloudPlayer cloudPlayer : cloudPlayers) cloudPlayer.setPlayerExecutor(PlayerExecutorBridge.INSTANCE);
return cloudPlayers;
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.result.Result in project CloudNet by Dytanic.
the class CloudAPI method getOfflinePlayer.
/**
* Returns a offline player which registerd or null
*
* @param name
*/
public OfflinePlayer getOfflinePlayer(String name) {
CloudPlayer cloudPlayer = checkAndGet(name);
if (cloudPlayer != null)
return cloudPlayer;
Result result = networkConnection.getPacketManager().sendQuery(new PacketAPIOutGetOfflinePlayer(name), networkConnection);
return result.getResult().getObject("player", new TypeToken<OfflinePlayer>() {
}.getType());
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.result.Result in project CloudNet by Dytanic.
the class CloudAPI method getOnlinePlayer.
/**
* Retuns a online CloudPlayer on network or null if the player isn't online
*/
public CloudPlayer getOnlinePlayer(UUID uniqueId) {
CloudPlayer instance = checkAndGet(uniqueId);
if (instance != null)
return instance;
Result result = networkConnection.getPacketManager().sendQuery(new PacketAPIOutGetPlayer(uniqueId), networkConnection);
CloudPlayer cloudPlayer = result.getResult().getObject("player", CloudPlayer.TYPE);
if (cloudPlayer == null)
return null;
cloudPlayer.setPlayerExecutor(PlayerExecutorBridge.INSTANCE);
return cloudPlayer;
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.result.Result in project CloudNet by Dytanic.
the class DatabaseImpl method getDocument.
@Override
public Document getDocument(String name) {
Result result = CloudAPI.getInstance().getNetworkConnection().getPacketManager().sendQuery(new PacketDBOutGetDocument(name, this.name), CloudAPI.getInstance().getNetworkConnection());
Document document = result.getResult().getDocument("result");
this.docs.put(document.getString(Database.UNIQUE_NAME_KEY), document);
return document;
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.result.Result in project CloudNet by Dytanic.
the class CloudAPI method getOfflinePlayer.
/**
* Returns a offline player which registerd or null
*
* @param uniqueId
*/
public OfflinePlayer getOfflinePlayer(UUID uniqueId) {
CloudPlayer cloudPlayer = checkAndGet(uniqueId);
if (cloudPlayer != null)
return cloudPlayer;
Result result = networkConnection.getPacketManager().sendQuery(new PacketAPIOutGetOfflinePlayer(uniqueId), networkConnection);
return result.getResult().getObject("player", new TypeToken<OfflinePlayer>() {
}.getType());
}
Aggregations