use of com.github.games647.changeskin.bungee.task.SkinInvalidator in project ChangeSkin by games647.
the class InvalidateCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
if (!(src instanceof Player)) {
plugin.sendMessage(src, "no-console");
return CommandResult.empty();
}
Player receiver = (Player) src;
Task.builder().async().execute(new SkinInvalidator(plugin, receiver)).submit(plugin);
return CommandResult.success();
}
use of com.github.games647.changeskin.bungee.task.SkinInvalidator in project ChangeSkin by games647.
the class InvalidateCommand method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (plugin.isBungeeCord()) {
onBungeeCord(sender, command.getName(), args);
return true;
}
if (args.length > 0) {
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
if (targetPlayer == null) {
plugin.sendMessage(sender, "not-online");
return true;
}
String permPrefix = plugin.getName().toLowerCase() + ".command.skinupdate.other.";
if (!sender.hasPermission(permPrefix + targetPlayer.getUniqueId()) && !sender.hasPermission(permPrefix + '*')) {
plugin.sendMessage(sender, "no-permission-other");
return true;
}
Runnable skinInvalidate = new SkinInvalidator(plugin, sender, targetPlayer);
Bukkit.getScheduler().runTaskAsynchronously(plugin, skinInvalidate);
return true;
}
if (!(sender instanceof Player)) {
plugin.sendMessage(sender, "no-console");
return true;
}
Player receiver = (Player) sender;
Bukkit.getScheduler().runTaskAsynchronously(plugin, new SkinInvalidator(plugin, sender, receiver));
return true;
}
use of com.github.games647.changeskin.bungee.task.SkinInvalidator in project ChangeSkin by games647.
the class InvalidateCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
boolean isOp = sender.getGroups().contains(plugin.getName() + "-OP");
if (sender instanceof ProxiedPlayer) {
sender.removeGroups(plugin.getName() + "-OP");
}
if (args.length > 0) {
ProxiedPlayer targetPlayer = ProxyServer.getInstance().getPlayer(args[0]);
if (targetPlayer == null) {
plugin.sendMessage(sender, "not-online");
return;
}
String permPrefix = plugin.getName().toLowerCase() + ".command.skinupdate.other.";
if (!sender.hasPermission(permPrefix + targetPlayer.getUniqueId()) && !sender.hasPermission(permPrefix + '*')) {
plugin.sendMessage(sender, "no-permission-other");
return;
}
Runnable skinInvalidate = new SkinInvalidator(plugin, sender, targetPlayer, isOp);
ProxyServer.getInstance().getScheduler().runAsync(plugin, skinInvalidate);
return;
}
if (!(sender instanceof ProxiedPlayer)) {
plugin.sendMessage(sender, "no-console");
return;
}
ProxiedPlayer receiver = (ProxiedPlayer) sender;
Runnable skinInvalidate = new SkinInvalidator(plugin, sender, receiver, isOp);
ProxyServer.getInstance().getScheduler().runAsync(plugin, skinInvalidate);
}
Aggregations