From 3ac7785cc3553a2efd614ea8d995bb3ba359e990 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Thu, 10 Jan 2019 21:34:52 +0100 Subject: [PATCH] Skip empty files in DebugPaste --- .../plotsquared/plot/commands/DebugPaste.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index bb03b384b..81275cac7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -82,9 +82,23 @@ import java.util.List; "&clatest.log is too big to be pasted, will ignore"); } - incendoPaster.addFile(new IncendoPaster.PasteFile("settings.yml", readFile(PlotSquared.get().configFile))); - incendoPaster.addFile(new IncendoPaster.PasteFile("worlds.yml", readFile(PlotSquared.get().worldsFile))); - incendoPaster.addFile(new IncendoPaster.PasteFile("PlotSquared.use_THIS.yml", readFile(PlotSquared.get().translationFile))); + try { + incendoPaster.addFile(new IncendoPaster.PasteFile("settings.yml", readFile(PlotSquared.get().configFile))); + } catch (final IllegalArgumentException ignored) { + MainUtil.sendMessage(player, "&cSkipping settings.yml because it's empty"); + } + try { + incendoPaster.addFile(new IncendoPaster.PasteFile("worlds.yml", readFile(PlotSquared.get().worldsFile))); + } catch (final IllegalArgumentException ignored) { + MainUtil.sendMessage(player, "&cSkipping worlds.yml because it's empty"); + } + try { + incendoPaster.addFile(new IncendoPaster.PasteFile("PlotSquared.use_THIS.yml", + readFile(PlotSquared.get().translationFile))); + } catch (final IllegalArgumentException ignored) { + MainUtil.sendMessage(player, "&cSkipping PlotSquared.use_THIS.yml because it's empty"); + } + try { final String rawResponse = incendoPaster.upload(); final JsonObject jsonObject = new JsonParser().parse(rawResponse).getAsJsonObject();