mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2026-11-04 08:52:06 -05:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ec162393 | ||
|
|
12561adfad | ||
|
|
7d21d2f1d7 | ||
|
|
31a050af54 |
No files matched your search
+1
-1
@@ -9,7 +9,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "me.clip"
|
||||
version = "2.12.3-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||
version = "2.12.4-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||
|
||||
description = "An awesome placeholder provider!"
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
package me.clip.placeholderapi.commands.impl.cloud;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
@@ -39,16 +38,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
||||
super("download");
|
||||
}
|
||||
|
||||
private boolean isBlockedExpansion(String name) {
|
||||
String env = System.getenv("PAPI_BLOCKED_EXPANSIONS");
|
||||
if (env == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Arrays.stream(env.split(","))
|
||||
.anyMatch(s -> s.equalsIgnoreCase(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||
@@ -59,12 +48,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBlockedExpansion(params.get(0))) {
|
||||
Msg.msg(sender,
|
||||
"&cThis expansion can't be downloaded.");
|
||||
return;
|
||||
}
|
||||
|
||||
final CloudExpansion expansion = plugin.getCloudExpansionManager()
|
||||
.findCloudExpansionByName(params.get(0)).orElse(null);
|
||||
if (expansion == null) {
|
||||
@@ -91,11 +74,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (!version.isVerified()) {
|
||||
Msg.msg(sender, "&cThe expansion '&f" + params.get(0) + "&c' is not verified and can only be downloaded manually from &fhttps://ecloud.placeholderapi.com");
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getCloudExpansionManager().downloadExpansion(expansion, version)
|
||||
.whenComplete((file, exception) -> {
|
||||
if (exception != null) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -274,6 +275,16 @@ public final class CloudExpansionManager {
|
||||
@NotNull
|
||||
public CompletableFuture<File> downloadExpansion(@NotNull final CloudExpansion expansion,
|
||||
@NotNull final CloudExpansion.Version version) {
|
||||
final String blockedExpansions = System.getenv("PAPI_BLOCKED_EXPANSIONS");
|
||||
if (blockedExpansions != null && Arrays.stream(blockedExpansions.split(","))
|
||||
.anyMatch(name -> name.equalsIgnoreCase(expansion.getName()))) {
|
||||
return failedDownload("This expansion can't be downloaded.");
|
||||
}
|
||||
|
||||
if (!version.isVerified()) {
|
||||
return failedDownload("The expansion is not verified and can only be downloaded manually from https://ecloud.placeholderapi.com");
|
||||
}
|
||||
|
||||
final CompletableFuture<File> previous = await.get(toIndexName(expansion));
|
||||
if (previous != null) {
|
||||
return previous;
|
||||
@@ -309,4 +320,10 @@ public final class CloudExpansionManager {
|
||||
return download;
|
||||
}
|
||||
|
||||
private CompletableFuture<File> failedDownload(String message) {
|
||||
final CompletableFuture<File> failed = new CompletableFuture<>();
|
||||
failed.completeExceptionally(new IllegalArgumentException(message));
|
||||
return failed;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user