some refractor

This commit is contained in:
scienziato1pazzo 2025-01-03 21:22:45 +01:00
parent 3d72701d1a
commit 75b6cf121b
4 changed files with 10 additions and 25 deletions

View File

@ -52,7 +52,8 @@ import org.jetbrains.annotations.Unmodifiable;
public final class PlaceholderCommandRouter implements CommandExecutor, TabCompleter { public final class PlaceholderCommandRouter implements CommandExecutor, TabCompleter {
@Unmodifiable @Unmodifiable
private static final List<PlaceholderCommand> COMMANDS = ImmutableList.of(new CommandHelp(), private static final List<PlaceholderCommand> COMMANDS = ImmutableList.of(
new CommandHelp(),
new CommandInfo(), new CommandInfo(),
new CommandList(), new CommandList(),
new CommandDump(), new CommandDump(),

View File

@ -148,17 +148,9 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
final int expansionNumber = index + ((page - 1) * PAGE_SIZE) + 1; final int expansionNumber = index + ((page - 1) * PAGE_SIZE) + 1;
line.append(text(expansionNumber + ". ", DARK_GRAY)); line.append(text(expansionNumber + ". ", DARK_GRAY));
final NamedTextColor expansionColour; final NamedTextColor expansionColour = expansion.shouldUpdate()
? GOLD
if (expansion.shouldUpdate()) { : (expansion.hasExpansion() ? GREEN : GRAY);
expansionColour = GOLD;
} else {
if (expansion.hasExpansion()) {
expansionColour = GREEN;
} else {
expansionColour = GRAY;
}
}
line.append(text(expansion.getName(), expansionColour)); line.append(text(expansion.getName(), expansionColour));

View File

@ -40,11 +40,8 @@ public final class Futures {
@NotNull final CompletableFuture<T> future, @NotNull final CompletableFuture<T> future,
@NotNull final BiConsumer<T, Throwable> consumer) { @NotNull final BiConsumer<T, Throwable> consumer) {
future.whenComplete((value, exception) -> { future.whenComplete((value, exception) -> {
if (Bukkit.isPrimaryThread()) { if (Bukkit.isPrimaryThread()) consumer.accept(value, exception);
consumer.accept(value, exception); else Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
} else {
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
}
}); });
} }

View File

@ -56,20 +56,15 @@ public final class Msg {
} }
public static void msg(@NotNull final CommandSender sender, @NotNull final String... messages) { public static void msg(@NotNull final CommandSender sender, @NotNull final String... messages) {
if (messages.length == 0) { if (messages.length == 0) return;
return;
}
sender.sendMessage(Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n"))); sender.sendMessage(Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
} }
public static void broadcast(@NotNull final String... messages) { public static void broadcast(@NotNull final String... messages) {
if (messages.length == 0) { if (messages.length == 0) return;
return;
}
Bukkit.broadcastMessage( Bukkit.broadcastMessage(Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
} }
public static String color(@NotNull final String text) { public static String color(@NotNull final String text) {