public void updateInformation(ApiClient client) throws IOException, ApiException { serverInformation = client.getServerInformation(); } }
@Override public void run() { List<Integer> commandsToPost = new ArrayList<>(); while (commandsToPost.size() < MAXIMUM_COMMANDS_TO_POST) { Integer posted = completed.poll(); if (posted == null) break; commandsToPost.add(posted); } if (!commandsToPost.isEmpty()) { try { platform.getApiClient().deleteCommand(commandsToPost); } catch (IOException | ApiException e) { platform.log(Level.SEVERE, "Unable to mark commands as completed", e); // TODO: Retry? } } }
@Override public void run() { try { plugin.getApiClient().createCoupon(coupon); sender.sendMessage(ChatColor.GREEN + plugin.getI18n().get("coupon_creation_success", coupon.getCode())); } catch (ApiException | IOException e) { sender.sendMessage(ChatColor.RED + e.getMessage()); } } });
@Override public void run() { try { plugin.getApiClient().deleteCoupon(code); sender.sendMessage(ChatColor.GREEN + plugin.getI18n().get("coupon_deleted")); } catch (ApiException | IOException e) { sender.sendMessage(ChatColor.RED + e.getMessage()); return; } } });
@Override public void run() { CheckoutUrlResponse response; try { if(!isCategory){ response = plugin.getApiClient().getCheckoutUri(player.getName(), id); }else{ response = plugin.getApiClient().getCategoryUri(player.getName(), id); } } catch (IOException | ApiException e) { if(sender == null) player.sendMessage(ChatColor.RED + plugin.getI18n().get("cant_check_out") + " " + e.getMessage()); else sender.sendMessage(ChatColor.RED + plugin.getI18n().get("cant_check_out") + " " + e.getMessage()); return; } if(!isCategory) { player.sendMessage(ChatColor.STRIKETHROUGH + " "); player.sendMessage(ChatColor.GREEN + plugin.getI18n().get("to_buy_this_package")); player.sendMessage(ChatColor.BLUE + ChatColor.UNDERLINE.toString() + response.getUrl()); player.sendMessage(ChatColor.STRIKETHROUGH + " "); }else{ player.sendMessage(ChatColor.STRIKETHROUGH + " "); player.sendMessage(ChatColor.GREEN + plugin.getI18n().get("to_view_this_category")); player.sendMessage(ChatColor.BLUE + ChatColor.UNDERLINE.toString() + response.getUrl()); player.sendMessage(ChatColor.STRIKETHROUGH + " "); } } }
payments = plugin.getApiClient().getRecentPayments(Math.min(100, maxPos.getAsInt())); } catch (IOException | ApiException e) { plugin.getLogger().error("Could not fetch recent purchases", e);
@Override public void run() { CheckoutUrlResponse response; try { response = plugin.getApiClient().getCheckoutUri(player.getName(), pkgId); } catch (IOException | ApiException e) { player.sendMessage( Text.builder(plugin.getI18n().get("cant_check_out")).color(TextColors.RED).build()); return; } if (response != null) { player.sendMessage(Text.builder(" ").style(TextStyles.STRIKETHROUGH).build()); try { player.sendMessages( Text.builder(plugin.getI18n().get("to_buy_this_package")).color(TextColors.GREEN).build(), Text.builder(response.getUrl()).color(TextColors.BLUE).style(TextStyles.UNDERLINE) .onClick(TextActions.openUrl(new URL(response.getUrl()))).build()); } catch (MalformedURLException e) { e.printStackTrace(); } player.sendMessage(Text.builder(" ").style(TextStyles.STRIKETHROUGH).build()); } } }
@Override public void run() { try { plugin.getApiClient().createCoupon(coupon); sender.sendMessage(TextFormat.GREEN + plugin.getI18n().get("coupon_creation_success", coupon.getCode())); } catch (ApiException | IOException e) { sender.sendMessage(TextFormat.RED + plugin.getI18n().get("generic_api_operation_error")); } } });
@Override public void run() { try { plugin.getApiClient().deleteCoupon(code); sender.sendMessage(TextFormat.GREEN + plugin.getI18n().get("coupon_deleted")); } catch (ApiException | IOException e) { sender.sendMessage(TextFormat.RED + e.getMessage()); return; } } });
payments = plugin.getApiClient().getRecentPayments(Math.min(100, max)); } catch (IOException | ApiException e) { plugin.getLogger().log(Level.SEVERE, "Could not fetch recent purchases", e);
public void updateInformation(ApiClient client) throws IOException, ApiException { serverInformation = client.getServerInformation(); } }
@Override public void run() { try { plugin.getApiClient().createCoupon(coupon); sender.sendMessage(ChatColor.GREEN + plugin.getI18n().get("coupon_creation_success", coupon.getCode())); } catch (ApiException | IOException e) { sender.sendMessage(ChatColor.RED + plugin.getI18n().get("generic_api_operation_error")); } } });
@Override public void run() { try { plugin.getApiClient().deleteCoupon(code); sender.sendMessage(ChatColor.GREEN + plugin.getI18n().get("coupon_deleted")); } catch (ApiException | IOException e) { sender.sendMessage(ChatColor.RED + e.getMessage()); return; } } });
public void flush() { if (!completed.isEmpty()) { for (List<Integer> list : Lists.partition(new ArrayList<>(completed), MAXIMUM_COMMANDS_TO_POST)) { try { platform.getApiClient().deleteCommand(list); } catch (IOException | ApiException e) { platform.log(Level.SEVERE, "Unable to mark commands as completed", e); break; } } } } }
public void initializeTasks() { try { serverInformation = platform.getApiClient().getServerInformation(); } catch (IOException | ApiException e) { throw new RuntimeException("Can't fetch account information", e); } executorService.schedule(playerFetcher = new DuePlayerFetcher(platform, verbose), 1, TimeUnit.SECONDS); }
@Override public void run() { try { plugin.getApiClient().createCoupon(coupon); source.sendMessage(Text.builder(plugin.getI18n().get("coupon_creation_success", coupon.getCode())) .color(TextColors.GREEN) .build()); } catch (ApiException | IOException e) { source.sendMessage(Text.builder(plugin.getI18n().get("generic_api_operation_error")) .color(TextColors.RED) .build()); } } });
@Override public void run() { try { plugin.getApiClient().deleteCoupon(code); source.sendMessage(Text.builder(plugin.getI18n().get("coupon_deleted")) .color(TextColors.GREEN) .build()); } catch (ApiException | IOException e) { source.sendMessage(Text.builder(e.getMessage()) .color(TextColors.RED) .build()); } } });
public void updateInformation(ApiClient client) throws IOException, ApiException { serverInformation = client.getServerInformation(); if (!configuration.isBungeeCord() && getServer().getOnlineMode() != serverInformation.getAccount().isOnlineMode()) { getLogger().log(Level.WARNING, "Your server and webstore online mode settings are mismatched. Unless you are using" + " a proxy and server combination (such as BungeeCord/Spigot or LilyPad/Connect) that corrects UUIDs, then" + " you may experience issues with packages not applying."); getLogger().log(Level.WARNING, "If you have verified that your set up is correct, you can suppress this message by setting " + "is-bungeecord=true in your BuycraftX config.properties."); } } }
public void updateInformation(ApiClient client) throws IOException, ApiException { serverInformation = client.getServerInformation(); if (!configuration.isBungeeCord() && Sponge.getServer().getOnlineMode() != serverInformation.getAccount().isOnlineMode()) { getLogger().warn("Your server and webstore online mode settings are mismatched. Unless you are using" + " a proxy and server combination (such as BungeeCord/Spigot or LilyPad/Connect) that corrects UUIDs, then" + " you may experience issues with packages not applying."); getLogger().warn("If you have verified that your set up is correct, you can suppress this message by setting " + "is-bungeecord=true in your BuycraftX config.properties."); } }