Tofpu / SpeedBridge2

Returned Futures should not be ignored JAVA-W1087
Anti-pattern
Major
9 months ago9 months old
257     */
258    public static void whenComplete(final CompletableFuture<?> completableFuture,
259            final Runnable whenComplete) {
260        completableFuture.whenComplete((o, throwable) -> {261            if (throwable != null) {262                throw new IllegalStateException(throwable);263            }264            whenComplete.run();265        });266    }
267
268    public static void runBukkitSync(final Runnable runnable, final int delay) {
448    }
449
450    private <T> void onCompletion(final CompletableFuture<T> future, final Consumer<T> consumer) {
451        future.whenComplete((t, throwable) -> {452            if (throwable != null) {453                throwable.printStackTrace();454                return;455            }456            consumer.accept(t);457        });458    }
459
460    public enum ResetType {
314                .getDataFolder());
315        completableFutures[1] = ConfigurationManager.INSTANCE.reload();
316
317        CompletableFuture.allOf(completableFutures)318                .whenComplete((unused, throwable) -> {319                    // reloading the blocks320                    BlockMenuManager.INSTANCE.reload();321322                    if (player.getPlayer() != null) {323                        BridgeUtil.sendMessage(player, INSTANCE.reloaded);324                    }325                });326    }
327
328    @Subcommand("help")
131        });
132
133        log("Loading the messages...");
134        Message.load(javaPlugin.getDataFolder());135
136        log("Generating `/sb help` message...");
137        HelpCommandGenerator.generateHelpCommand(javaPlugin);