use of net.dzikoysk.funnyguilds.event.guild.GuildUnbanEvent in project FunnyGuilds by FunnyGuilds.
the class AxcUnban method execute.
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
Guild guild = GuildUtils.getByTag(args[0]);
if (guild == null) {
sender.sendMessage(messages.generalNoGuildFound);
return;
}
if (!guild.isBanned()) {
sender.sendMessage(messages.adminGuildNotBanned);
return;
}
User admin = (sender instanceof Player) ? User.get(sender.getName()) : null;
if (!SimpleEventHandler.handle(new GuildUnbanEvent(admin == null ? EventCause.CONSOLE : EventCause.ADMIN, admin, guild))) {
return;
}
BanUtils.unban(guild);
MessageTranslator translator = new MessageTranslator().register("{GUILD}", guild.getName()).register("{TAG}", guild.getName()).register("{ADMIN}", sender.getName());
sender.sendMessage(translator.translate(messages.adminGuildUnban));
Bukkit.broadcastMessage(translator.translate(messages.broadcastUnban));
}
Aggregations