From b233c92ca18f3fe1dced36b3d23cc5a615de4969 Mon Sep 17 00:00:00 2001 From: PiggyPiglet Date: Mon, 2 Feb 2026 17:10:50 +0800 Subject: [PATCH] Add warning message to failed ecloud download --- .../placeholderapi/commands/impl/cloud/CommandECloud.java | 5 +++++ .../expansion/manager/CloudExpansionManager.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/me/clip/placeholderapi/commands/impl/cloud/CommandECloud.java b/src/main/java/me/clip/placeholderapi/commands/impl/cloud/CommandECloud.java index 5f3b650..872f12e 100644 --- a/src/main/java/me/clip/placeholderapi/commands/impl/cloud/CommandECloud.java +++ b/src/main/java/me/clip/placeholderapi/commands/impl/cloud/CommandECloud.java @@ -118,6 +118,11 @@ public final class CommandECloud extends PlaceholderCommand { return; } + if (!target.getLabel().equalsIgnoreCase("refresh") && plugin.getCloudExpansionManager().isEmpty()) { + Msg.msg(sender, "&cThere is no available data from the eCloud. Please try running &f/papi ecloud refresh&c. If this does not resolve the issue, the eCloud may be blocked by your firewall, server host, or service provider.\n\nMore information: &fhttps://placeholderapi.com/ecloud-blocked"); + return; + } + target.evaluate(plugin, sender, search, params.subList(1, params.size())); } diff --git a/src/main/java/me/clip/placeholderapi/expansion/manager/CloudExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/manager/CloudExpansionManager.java index dea0d9c..0f739c1 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/manager/CloudExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/manager/CloudExpansionManager.java @@ -31,6 +31,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Type; import java.net.URL; +import java.net.UnknownHostException; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.charset.StandardCharsets; @@ -115,6 +116,10 @@ public final class CloudExpansionManager { return ImmutableMap.copyOf(cache); } + public boolean isEmpty() { + return cache.isEmpty(); + } + @NotNull @Unmodifiable public Map getCloudExpansionsInstalled() { @@ -197,6 +202,8 @@ public final class CloudExpansionManager { for (String name : toRemove) { values.remove(name); } + } catch (UnknownHostException e) { + plugin.getLogger().log(Level.WARNING, "There is no data available from the eCloud. Please try running /papi refresh. If this does not resolve the issue, the eCloud may be blocked by your firewall, server host, or service provider.\n\nMore information: https://placeholderapi.com/ecloud-blocked", e); } catch (Throwable e) { // ugly swallowing of every throwable, but we have to be defensive plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);