@Override public void run() { run(true); }
@Override public void run() { plugin.getDuePlayerFetcher().run(false); } });
@Override public void run() { plugin.getDuePlayerFetcher().run(false); } });
@Override public void execute(CommandSender sender, String[] args) { if (args.length != 0) { sender.sendMessage(TextFormat.RED + plugin.getI18n().get("no_params")); return; } if (plugin.getApiClient() == null) { sender.sendMessage(TextFormat.RED + plugin.getI18n().get("need_secret_key")); return; } if (plugin.getDuePlayerFetcher().inProgress()) { sender.sendMessage(TextFormat.RED + plugin.getI18n().get("already_checking_for_purchases")); return; } plugin.getPlatform().executeAsync(() -> plugin.getDuePlayerFetcher().run(false)); sender.sendMessage(TextFormat.GREEN + plugin.getI18n().get("forcecheck_queued")); }
@Override public void run() { String currentKey = plugin.getConfiguration().getServerKey(); ApiClient client = new ProductionApiClient((String) args.getOne("secret").get(), plugin.getHttpClient()); try { plugin.updateInformation(client); } catch (IOException | ApiException e) { plugin.getLogger().error("Unable to verify secret", e); src.sendMessage(Text.builder(plugin.getI18n().get("secret_does_not_work")).color(TextColors.RED).build()); return; } ServerInformation information = plugin.getServerInformation(); plugin.setApiClient(client); plugin.getListingUpdateTask().run(); plugin.getConfiguration().setServerKey((String) args.getOne("secret").get()); try { plugin.saveConfiguration(); } catch (IOException e) { src.sendMessage(Text.builder(plugin.getI18n().get("secret_cant_be_saved")).color(TextColors.RED).build()); } src.sendMessage(Text.builder(plugin.getI18n().get("secret_success", information.getServer().getName(), information.getAccount().getName())).color(TextColors.GREEN).build()); boolean repeatChecks = false; if (currentKey == "INVALID") { repeatChecks = true; } plugin.getDuePlayerFetcher().run(repeatChecks); } });
@Override public void run() { String currentKey = plugin.getConfiguration().getServerKey(); ApiClient client = new ProductionApiClient(args[0], plugin.getHttpClient()); try { plugin.updateInformation(client); } catch (Exception e) { plugin.getLogger().log(Level.SEVERE, "Unable to verify secret", e); sender.sendMessage(ChatColor.RED + plugin.getI18n().get("secret_does_not_work")); return; } ServerInformation information = plugin.getServerInformation(); plugin.setApiClient(client); plugin.getListingUpdateTask().run(); plugin.getConfiguration().setServerKey(args[0]); try { plugin.saveConfiguration(); } catch (IOException e) { sender.sendMessage(ChatColor.RED + plugin.getI18n().get("secret_cant_be_saved")); } sender.sendMessage(ChatColor.GREEN + plugin.getI18n().get("secret_success", information.getServer().getName(), information.getAccount().getName())); boolean repeatChecks = false; if (currentKey == "INVALID") { repeatChecks = true; } plugin.getDuePlayerFetcher().run(repeatChecks); } });
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { if (plugin.getApiClient() == null) { sender.sendMessage(Text.builder(plugin.getI18n().get("need_secret_key")).color(TextColors.RED).build()); return CommandResult.success(); } if (plugin.getDuePlayerFetcher().inProgress()) { sender.sendMessage(Text.builder(plugin.getI18n().get("already_checking_for_purchases")).color(TextColors.RED).build()); return CommandResult.success(); } Sponge.getScheduler().createTaskBuilder().execute(() -> plugin.getDuePlayerFetcher().run(false)).async().submit(plugin); sender.sendMessage(Text.builder(plugin.getI18n().get("forcecheck_queued")).color(TextColors.GREEN).build()); return CommandResult.success(); } }
@Override public void run() { String currentKey = plugin.getConfiguration().getServerKey(); ApiClient client = new ProductionApiClient(args[0], plugin.getHttpClient()); try { plugin.updateInformation(client); } catch (IOException | ApiException e) { plugin.getLogger().error("Unable to verify secret", e); sender.sendMessage(TextFormat.RED + plugin.getI18n().get("secret_does_not_work")); return; } ServerInformation information = plugin.getServerInformation(); plugin.setApiClient(client); plugin.getConfiguration().setServerKey(args[0]); try { plugin.saveConfiguration(); } catch (IOException e) { sender.sendMessage(TextFormat.RED + plugin.getI18n().get("secret_cant_be_saved")); } sender.sendMessage(TextFormat.GREEN + plugin.getI18n().get("secret_success", information.getServer().getName(), information.getAccount().getName())); boolean repeatChecks = false; if (currentKey == "INVALID") { repeatChecks = true; } plugin.getDuePlayerFetcher().run(repeatChecks); } });