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 {
|
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(),
|
||||||
|
@ -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));
|
||||||
|
|
||||||
|
@ -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));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user