Add user-friendly message when host can't connect to ecloud

This commit is contained in:
darbyjack 2020-03-25 23:04:00 -05:00
parent e95f1b4850
commit 449c927c6c
No known key found for this signature in database
GPG Key ID: 597C501782382437
3 changed files with 11 additions and 1 deletions

View File

@ -47,6 +47,10 @@ public class PlaceholderAPIConfig {
return plugin.getConfig().getBoolean("cloud_enabled"); return plugin.getConfig().getBoolean("cloud_enabled");
} }
public boolean isDebugMode() {
return plugin.getConfig().getBoolean("debug", false);
}
public void setCloudEnabled(boolean b) { public void setCloudEnabled(boolean b) {
plugin.getConfig().set("cloud_enabled", b); plugin.getConfig().set("cloud_enabled", b);
plugin.reloadConfig(); plugin.reloadConfig();

View File

@ -169,7 +169,12 @@ public class ExpansionCloudManager {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(API_URL).openStream()))) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(API_URL).openStream()))) {
data.putAll(GSON.fromJson(reader, new TypeToken<Map<String, CloudExpansion>>() {}.getType())); data.putAll(GSON.fromJson(reader, new TypeToken<Map<String, CloudExpansion>>() {}.getType()));
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); if (plugin.getPlaceholderAPIConfig().isDebugMode()) {
ex.printStackTrace();
}
else {
plugin.getLogger().warning("Unable to fetch expansions!\nThere was an error with the server host connecting to the PlaceholderAPI eCloud (https://api.extendedclip.com/v2/)");
}
} }
final List<CloudExpansion> unsorted = new ArrayList<>(); final List<CloudExpansion> unsorted = new ArrayList<>();

View File

@ -15,3 +15,4 @@ boolean:
'true': 'yes' 'true': 'yes'
'false': 'no' 'false': 'no'
date_format: MM/dd/yy HH:mm:ss date_format: MM/dd/yy HH:mm:ss
debug: false