use of net.md_5.bungee.api.connection.ProxiedPlayer in project CloudNet by Dytanic.
the class CloudProxy method update.
public void update() {
ProxyInfo proxyInfo = new ProxyInfo(CloudAPI.getInstance().getServiceId(), CloudAPI.getInstance().getConfig().getString("host"), 0, true, new ArrayList<>(CollectionWrapper.transform(ProxyServer.getInstance().getPlayers(), new Catcher<MultiValue<UUID, String>, ProxiedPlayer>() {
@Override
public MultiValue<UUID, String> doCatch(ProxiedPlayer key) {
return new MultiValue<>(key.getUniqueId(), key.getName());
}
})), proxyProcessMeta.getMemory(), ProxyServer.getInstance().getOnlineCount());
CloudAPI.getInstance().update(proxyInfo);
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project commands by aikar.
the class ACFBungeeListener method onPlayerJoin.
@EventHandler
public void onPlayerJoin(PostLoginEvent loginEvent) {
ProxiedPlayer player = loginEvent.getPlayer();
// the client settings are sent after a successful login
Runnable task = () -> manager.readLocale(player);
plugin.getProxy().getScheduler().schedule(plugin, task, 1, TimeUnit.SECONDS);
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project commands by aikar.
the class ACFBungeeListener method onDisconnect.
@EventHandler
public void onDisconnect(PlayerDisconnectEvent disconnectEvent) {
// cleanup
ProxiedPlayer player = disconnectEvent.getPlayer();
manager.issuersLocale.remove(player.getUniqueId());
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project ChangeSkin by games647.
the class InfoCommand method execute.
@Override
public void execute(CommandSender sender, String[] strings) {
if (!(sender instanceof ProxiedPlayer)) {
plugin.sendMessage(sender, "no-console");
return;
}
ProxiedPlayer player = (ProxiedPlayer) sender;
UserPreference preference = plugin.getLoginSession((PendingConnection) player);
Optional<SkinModel> optSkin = preference.getTargetSkin();
if (optSkin.isPresent()) {
String template = plugin.getCore().getMessage("skin-info");
sender.sendMessage(TextComponent.fromLegacyText(formatter.apply(template, optSkin.get())));
} else {
plugin.sendMessage(sender, "skin-not-found");
}
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project ChangeSkin by games647.
the class MessageListener method onPermissionSuccess.
private void onPermissionSuccess(PermResultMessage message, ProxiedPlayer invoker) {
SkinModel targetSkin = message.getSkin();
UUID receiverUUID = message.getReceiverUUID();
ProxiedPlayer receiver = ProxyServer.getInstance().getPlayer(receiverUUID);
if (receiver == null || !receiver.isConnected()) {
// receiver is not online cancel
return;
}
// add cooldown
core.getCooldownService().trackPlayer(invoker.getUniqueId());
// Save the target uuid from the requesting player source
final UserPreference preferences = core.getStorage().getPreferences(receiver.getUniqueId());
preferences.setTargetSkin(targetSkin);
ProxyServer.getInstance().getScheduler().runAsync(plugin, () -> {
if (core.getStorage().save(targetSkin)) {
core.getStorage().save(preferences);
}
});
if (core.getConfig().getBoolean("instantSkinChange")) {
plugin.getApi().applySkin(receiver, targetSkin);
plugin.sendMessage(invoker, "skin-changed");
} else {
plugin.sendMessage(invoker, "skin-changed-no-instant");
}
}
Aggregations