use of com.github.games647.changeskin.core.message.ChannelMessage in project ChangeSkin by games647.
the class SkinApplier method run.
@Override
public void run() {
if (!isConnected()) {
return;
}
UUID receiverUUID = receiver.getUniqueId();
if (invoker instanceof ProxiedPlayer) {
if (targetSkin != null && core.getConfig().getBoolean("bukkit-permissions")) {
Server server = ((ProxiedPlayer) invoker).getServer();
boolean skinPerm = core.getConfig().getBoolean("skinPermission");
ChannelMessage message = new CheckPermMessage(targetSkin, receiverUUID, skinPerm, bukkitOp);
plugin.sendPluginMessage(server, message);
return;
}
// uuid was successful resolved, we could now make a cooldown check
core.getCooldownService().trackPlayer(((ProxiedPlayer) invoker).getUniqueId());
}
// check if that specific player is online
UserPreference preferences = plugin.getLoginSession(receiver.getPendingConnection());
if (preferences == null) {
preferences = plugin.getStorage().getPreferences(receiverUUID);
}
save(preferences);
applySkin();
}
use of com.github.games647.changeskin.core.message.ChannelMessage in project ChangeSkin by games647.
the class AbstractForwardCommand method onBungeeCord.
protected void onBungeeCord(CommandSender sender, String commandName, String... args) {
Player proxy;
boolean isPlayer = sender instanceof Player;
if (isPlayer) {
proxy = (Player) sender;
} else {
Optional<? extends Player> optPlayer = Bukkit.getOnlinePlayers().stream().findAny();
if (!optPlayer.isPresent()) {
sender.sendMessage(ChatColor.DARK_RED + "No player is online to forward this message to Bungee");
return;
}
proxy = optPlayer.get();
}
ChannelMessage message = new ForwardMessage(commandName, Joiner.on(' ').join(args), isPlayer, sender.isOp());
plugin.sendPluginMessage(proxy, message);
}
Aggregations