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 {
@Unmodifiable
private static final List<PlaceholderCommand> COMMANDS = ImmutableList.of(new CommandHelp(),
private static final List<PlaceholderCommand> COMMANDS = ImmutableList.of(
new CommandHelp(),
new CommandInfo(),
new CommandList(),
new CommandDump(),

View File

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

View File

@ -40,11 +40,8 @@ public final class Futures {
@NotNull final CompletableFuture<T> future,
@NotNull final BiConsumer<T, Throwable> consumer) {
future.whenComplete((value, exception) -> {
if (Bukkit.isPrimaryThread()) {
consumer.accept(value, exception);
} else {
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
}
if (Bukkit.isPrimaryThread()) 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) {
if (messages.length == 0) {
return;
}
if (messages.length == 0) return;
sender.sendMessage(Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
}
public static void broadcast(@NotNull final String... messages) {
if (messages.length == 0) {
return;
}
if (messages.length == 0) return;
Bukkit.broadcastMessage(
Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
Bukkit.broadcastMessage(Arrays.stream(messages).map(Msg::color).collect(Collectors.joining("\n")));
}
public static String color(@NotNull final String text) {