mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-05 03:45:28 +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));
|
.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
|
@Override
|
||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||||
@ -72,7 +90,7 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
|||||||
return;
|
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");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user