From 3e750703759549b5b0a622c88db51cf782ae8030 Mon Sep 17 00:00:00 2001 From: PiggyPiglet Date: Mon, 2 Feb 2026 20:07:22 +0800 Subject: [PATCH] Add eCloud blocked information msg to ecloud command --- .../commands/impl/cloud/CommandECloud.java | 10 ++++++++++ .../expansion/manager/CloudExpansionManager.java | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/at/helpch/placeholderapi/commands/impl/cloud/CommandECloud.java b/src/main/java/at/helpch/placeholderapi/commands/impl/cloud/CommandECloud.java index 7bb147d..f640aa5 100644 --- a/src/main/java/at/helpch/placeholderapi/commands/impl/cloud/CommandECloud.java +++ b/src/main/java/at/helpch/placeholderapi/commands/impl/cloud/CommandECloud.java @@ -142,6 +142,16 @@ public final class CommandECloud extends PlaceholderCommand { return; } + if (!target.getLabel().equalsIgnoreCase("refresh") && plugin.cloudExpansionManager().isEmpty()) { + sender.sendMessage(Message.raw("There is no available data from the eCloud. Please try running ").color(Color.RED) + .insert(Message.raw("/papi ecloud refresh").color(Color.WHITE)) + .insert(Message.raw(" If this does not resolve the issue, the eCloud may be blocked by your firewall, server host or service provider.\n\n").color(Color.RED)) + .insert(Message.raw("More information: ").color(Color.RED)) + .insert(Message.raw("https://placeholderapi.com/ecloud-blocked").color(Color.WHITE).bold(true).italic(true).link("https://placeholderapi.com/ecloud-blocked"))); +// 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/at/helpch/placeholderapi/expansion/manager/CloudExpansionManager.java b/src/main/java/at/helpch/placeholderapi/expansion/manager/CloudExpansionManager.java index 37015f2..518e1a0 100644 --- a/src/main/java/at/helpch/placeholderapi/expansion/manager/CloudExpansionManager.java +++ b/src/main/java/at/helpch/placeholderapi/expansion/manager/CloudExpansionManager.java @@ -29,6 +29,7 @@ import java.lang.reflect.Type; import java.net.URI; import java.net.URL; import java.net.URLConnection; +import java.net.UnknownHostException; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.charset.StandardCharsets; @@ -110,6 +111,10 @@ public final class CloudExpansionManager { return Map.copyOf(cache); } + public boolean isEmpty() { + return cache.isEmpty(); + } + @NotNull @Unmodifiable public Map getCloudExpansionsInstalled() { @@ -201,6 +206,8 @@ public final class CloudExpansionManager { for (String name : toRemove) { values.remove(name); } + } catch (UnknownHostException e) { + logger.atWarning().log("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 logger.atWarning().log("Failed to download expansion information", e);