mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-02-05 11:57:14 +01:00
eCloud disabled PAPI for CurseForge
This commit is contained in:
@@ -52,108 +52,16 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
|||||||
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,
|
||||||
@NotNull @Unmodifiable final List<String> params) {
|
@NotNull @Unmodifiable final List<String> params) {
|
||||||
if (params.isEmpty()) {
|
final Message message = Message.raw("""
|
||||||
sender.sendMessage(Message.raw("You must supply the name of an expansion.").color(Color.RED));
|
Expansion downloads have been disabled to meet CurseForge's policy requirements.
|
||||||
// Msg.msg(sender,
|
This limitation is imposed by the platform, not PlaceholderAPI.
|
||||||
// "&cYou must supply the name of an expansion.");
|
|
||||||
return;
|
""").color(Color.RED)
|
||||||
}
|
.insert(Message.raw("Please download expansions manually from ecloud.placeholderapi.com").link("https://ecloud.placeholderapi.com").bold(true).italic(true).color(Color.WHITE))
|
||||||
|
.insert(Message.raw(" or install the full version of PlaceholderAPI from ").color(Color.RED))
|
||||||
|
.insert(Message.raw("placeholderapi.com/downloads").link("https://placeholderapi.com/downloads").bold(true).italic(true).color(Color.WHITE));
|
||||||
|
|
||||||
if (isBlockedExpansion(params.get(0))) {
|
sender.sendMessage(message);
|
||||||
sender.sendMessage(Message.raw("This expansion can't be downloaded.").color(Color.RED));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&cThis expansion can't be downloaded.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final CloudExpansion expansion = plugin.cloudExpansionManager()
|
|
||||||
.findCloudExpansionByName(params.get(0)).orElse(null);
|
|
||||||
if (expansion == null) {
|
|
||||||
sender.sendMessage(Message.raw("Failed to find an expansion named: ").color(Color.GREEN).insert(Message.raw(params.get(0)).color(Color.WHITE)));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&cFailed to find an expansion named: &f" + params.get(0));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final CloudExpansion.Version version;
|
|
||||||
if (params.size() < 2) {
|
|
||||||
version = expansion.getVersion(expansion.getLatestVersion());
|
|
||||||
if (version == null) {
|
|
||||||
sender.sendMessage(Message.raw("Could not find latest version for expansion.").color(Color.RED));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&cCould not find latest version for expansion.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
version = expansion.getVersion(params.get(1));
|
|
||||||
if (version == null) {
|
|
||||||
sender.sendMessage(Message.raw("Could not find specified version: ").color(Color.RED)
|
|
||||||
.insert(Message.raw(params.get(0) + "\n").color(Color.WHITE))
|
|
||||||
.insert(Message.raw("Available versions: ").color(Color.GRAY))
|
|
||||||
.insert(Message.raw(expansion.getAvailableVersions().toString()).color(Color.WHITE)));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&cCould not find specified version: &f" + params.get(1),
|
|
||||||
// "&7Available versions: &f" + expansion.getAvailableVersions());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!version.isVerified()) {
|
|
||||||
sender.sendMessage(Message.raw("The expansion: '").color(Color.RED)
|
|
||||||
.insert(Message.raw(params.get(0)).color(Color.WHITE))
|
|
||||||
.insert(Message.raw("' is not verified and can only be downloaded manually from ").color(Color.RED))
|
|
||||||
.insert(Message.raw("https://ecloud.placeholderapi.com").color(Color.WHITE)));
|
|
||||||
// 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.cloudExpansionManager().downloadExpansion(expansion, version)
|
|
||||||
.whenComplete((file, exception) -> {
|
|
||||||
if (exception != null) {
|
|
||||||
sender.sendMessage(Message.raw("Failed to download expansion: ").color(Color.RED).insert(Message.raw(exception.getMessage()).color(Color.WHITE)));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&cFailed to download expansion: &f" + exception.getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(Message.raw("Successfully downloaded expansion ").color(Color.GREEN)
|
|
||||||
.insert(Message.raw(expansion.getName() + " [" + version.getVersion() + "] ").color(Color.WHITE))
|
|
||||||
.insert(Message.raw("to file: ").color(Color.GREEN))
|
|
||||||
.insert(Message.raw(file.getName()).color(Color.WHITE))
|
|
||||||
.insert(Message.raw("\nMake sure to type ").color(Color.GREEN))
|
|
||||||
.insert(Message.raw("/papi reload ").color(Color.GREEN))
|
|
||||||
.insert(Message.raw("to enable your new expansion!").color(Color.WHITE)));
|
|
||||||
// Msg.msg(sender,
|
|
||||||
// "&aSuccessfully downloaded expansion &f" + expansion.getName() + " [" + version
|
|
||||||
// .getVersion() + "] &ato file: &f" + file.getName(),
|
|
||||||
// "&aMake sure to type &f/papi reload &ato enable your new expansion!");
|
|
||||||
|
|
||||||
plugin.cloudExpansionManager().load();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void complete(@NotNull final PlaceholderAPIPlugin plugin,
|
|
||||||
// @NotNull final CommandSender sender, @NotNull final String alias,
|
|
||||||
// @NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
|
||||||
// if (params.size() > 2) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (params.size() <= 1) {
|
|
||||||
// final Stream<String> names = plugin.getCloudExpansionManager().getCloudExpansions().values()
|
|
||||||
// .stream().map(CloudExpansion::getName).map(name -> name.replace(' ', '_'));
|
|
||||||
// suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final Optional<CloudExpansion> expansion = plugin.getCloudExpansionManager()
|
|
||||||
// .findCloudExpansionByName(params.get(0));
|
|
||||||
// if (!expansion.isPresent()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// suggestByParameter(expansion.get().getAvailableVersions().stream(), suggestions, params.get(1));
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user