@Override public void run() { QueueInformation information; try { information = platform.getApiClient().getPlayerQueue(player.getId()); } catch (IOException | ApiException e) { // TODO: Implement retry logic. platform.log(Level.SEVERE, "Could not fetch command queue for player", e); return; } platform.log(Level.INFO, String.format("Fetched %d commands for player '%s'.", information.getCommands().size(), player.getName())); // Queue commands for later. for (QueuedCommand command : information.getCommands()) { platform.getExecutor().queue(new ToRunQueuedCommand(player, command, true)); } } }
@Override public void run() { if (platform.getApiClient() == null) { return; // no API client } QueueInformation information; try { // Retrieve offline command queue. information = platform.getApiClient().retrieveOfflineQueue(); } catch (IOException | ApiException e) { platform.log(Level.SEVERE, "Could not fetch command queue", e); return; } // Queue commands for later. for (QueuedCommand command : information.getCommands()) { platform.getExecutor().queue(new ToRunQueuedCommand(command.getPlayer(), command, false)); } } }