mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-05 15:55:28 +01:00
some refractor
This commit is contained in:
parent
3d72701d1a
commit
75b6cf121b
@ -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(),
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user