eCloud disabled PAPI for CurseForge

This commit is contained in:
PiggyPiglet
2026-01-30 18:11:12 +08:00
parent c308769e6d
commit ffd115296c

View File

@@ -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;
}
if (isBlockedExpansion(params.get(0))) { """).color(Color.RED)
sender.sendMessage(Message.raw("This expansion can't be downloaded.").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))
// Msg.msg(sender, .insert(Message.raw(" or install the full version of PlaceholderAPI from ").color(Color.RED))
// "&cThis expansion can't be downloaded."); .insert(Message.raw("placeholderapi.com/downloads").link("https://placeholderapi.com/downloads").bold(true).italic(true).color(Color.WHITE));
return;
}
final CloudExpansion expansion = plugin.cloudExpansionManager() sender.sendMessage(message);
.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));
// }
} }