use of de.dytanic.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer 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.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer in project CloudNet by Dytanic.
the class CommandPermissions method updatePlayer.
private void updatePlayer(OfflinePlayer offlinePlayer) {
CloudNet.getInstance().getDbHandlers().getPlayerDatabase().updatePlayer(offlinePlayer);
if (CloudNet.getInstance().getNetworkManager().getOnlinePlayers().containsKey(offlinePlayer.getUniqueId())) {
CloudNet.getInstance().getNetworkManager().getOnlinePlayers().get(offlinePlayer.getUniqueId()).setPermissionEntity(offlinePlayer.getPermissionEntity());
CloudNet.getInstance().getNetworkManager().handlePlayerUpdate(CloudNet.getInstance().getNetworkManager().getOnlinePlayers().get(offlinePlayer.getUniqueId()));
}
CloudNet.getInstance().getNetworkManager().sendAllUpdate(new PacketOutUpdateOfflinePlayer(offlinePlayer));
}
Aggregations