/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package FunctionLayer; import PresentationLayer.DiscordHandler; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.javacord.api.DiscordApi; import org.javacord.api.entity.user.User; import org.javacord.api.event.message.MessageCreateEvent; /** * * @author install1 */ public class DoStuff { public static boolean occupied = false; public static boolean isOccupied() { return occupied; } public static void doStuff(MessageCreateEvent event, DiscordApi api) { if (!event.getMessage().getAuthor().isYourself()) { occupied = true; String strtest = event.getServerTextChannel().get().getCategory().toString(); strtest = strtest.substring(9, strtest.length() - 1); boolean channelpermissionsDenied = false; switch (strtest) { case "Public Area": { break; } case "Information Area": { break; } default: { channelpermissionsDenied = true; break; } } if (!channelpermissionsDenied) { List userlist = event.getMessage().getMentionedUsers(); String strresult = event.getMessage().toString(); if (userlist != null) { for (User user : userlist) { strresult = strresult.replace(user.getIdAsString(), ""); } } MessageResponseHandler.getMessage(strresult); } if (event.getMessage().getMentionedUsers().contains(api.getYourself()) || event.getServerTextChannel().get().toString().contains("general-autism")) { try { String ResponseStr; String person = event.getMessageAuthor().getName(); ResponseStr = MessageResponseHandler.selectReponseMessage(event.getMessage().toString(), person); if (!ResponseStr.isEmpty()) { System.out.print("\nResponseStr3: " + ResponseStr + "\n"); event.getChannel().sendMessage(ResponseStr); } } catch (CustomError ex) { Logger.getLogger(DoStuff.class.getName()).log(Level.SEVERE, null, ex); } } new Thread(() -> { try { Datahandler.instance.checkIfUpdateStrings(false); } catch (CustomError ex) { Logger.getLogger(DiscordHandler.class.getName()).log(Level.SEVERE, null, ex); } }).start(); occupied = false; } } }