mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Add environment variable to override cloud_allowunverified_expansions
This adds the environment variable PAPI_ALLOW_UNVERIFIED_EXPANSIONS. It allows overriding the option set in the config.yml.
This commit is contained in:
parent
f91b4e3752
commit
92a7d54664
@ -48,6 +48,24 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
||||
.anyMatch(s -> s.equalsIgnoreCase(name));
|
||||
}
|
||||
|
||||
private boolean areUnverifiedExpansionsAllowed(@NotNull final PlaceholderAPIPlugin plugin) {
|
||||
String env = System.getenv("PAPI_ALLOW_UNVERIFIED_EXPANSIONS");
|
||||
if (env != null) {
|
||||
switch (env.toLowerCase()) {
|
||||
case "true":
|
||||
case "yes":
|
||||
case "1":
|
||||
return true;
|
||||
case "false":
|
||||
case "no":
|
||||
case "0":
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||
@ -72,7 +90,7 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!expansion.isVerified() && !plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions()) {
|
||||
if (!expansion.isVerified() && !this.areUnverifiedExpansionsAllowed(plugin)) {
|
||||
Msg.msg(sender, "&cThe expansion '&f" + params.get(0) + "&c' is not verified and can only be downloaded manually from &fhttps://placeholderapi.com/ecloud");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user