Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PartyCraft implements PartyCraftAPI {
- private Configuration configuration;
- private PartyCraft instance;
- private final Map<Guild, List<String>> ignoredChannelsMap = new HashMap<>();
- private boolean running;
- private TextChannelManager textChannelManager = new TextChannelManager();
- private TextChannelsUtil textChannelsUtil = new TextChannelsUtil(textChannelManager);
- private Logger logger;
- private JDA jda;
- public PartyCraft(Configuration configuration)
- {
- this.configuration = configuration;
- }
- private FileManager fileManager = new FileManager(textChannelManager, instance);
- @Override
- public void start() throws LoginException, InterruptedException {
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
- this.running = true;
- this.jda = new JDABuilder(AccountType.BOT)
- .setToken(configuration.getDiscordToken())
- .setAutoReconnect(true)
- .setAudioEnabled(false)
- .setEventManager(new AnnotatedEventManager())
- .setGame(Game.playing(this.configuration.getGame()))
- .buildBlocking();
- jda.addEventListener(new onTextChannelCreated(configuration,textChannelManager));
- jda.addEventListener(new onTextChannelRemoved(configuration,textChannelManager));
- CommandRegistry commandRegistry = new CommandRegistry(this);
- commandRegistry.register(
- new ProfileCommand(),
- new HelpCommand(),
- new KittyCommand(),
- new SetGameCommand(this),
- new IgnoreCommand(this),
- new KickCommand()
- );
- textChannelsUtil.printAllTextChannels(jda, configuration.getServerName());
- textChannelsUtil.registerAllTextChannels(jda, configuration.getServerName());
- fileManager.checkFiles();
- fileManager.makeNewLogFiles();
- try
- {
- logger = new Logger(fileManager.makeNewLogFilesForPlugin());
- } catch (FileNotFoundException e)
- {
- e.printStackTrace();
- }
- logger.info("Loaded Bot! =)");
- fileManager.test();
- logger.saveLogs();
- }
- @Override
- public Configuration getConfiguration()
- {
- return configuration;
- }
- @Override
- public JDA getJDA()
- {
- return jda;
- }
- @Override
- public boolean isRunning()
- {
- return running;
- }
- @Override
- public Map<Guild, List<String>> getIgnoredChannelsMap()
- {
- return ignoredChannelsMap;
- }
- public Logger getLogger()
- {
- return logger;
- }
- public TextChannelManager getTextChannelManager()
- {
- return this.textChannelManager;
- }
- public PartyCraft getInstance()
- {
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement