From af7a53e00590116647d6be4d3318b45ab2f40029 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 25 Dec 2020 23:22:17 +0100 Subject: [PATCH] Throw NoClipboardExceptions again! --- SpigotCore_14/src/de/steamwar/sql/Schematic_14.java | 10 +++++----- SpigotCore_8/src/de/steamwar/sql/Schematic_8.java | 4 ++-- .../src/de/steamwar/sql/NoClipboardException.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java b/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java index 675da6e..3e3164f 100644 --- a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java +++ b/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java @@ -69,12 +69,12 @@ class Schematic_14 { try { clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); } catch (EmptyClipboardException e) { - throw new RuntimeException(e.getMessage(), new NoClipboardException()); + throw new NoClipboardException(); } Clipboard clipboard = clipboardHolder.getClipboard(); if(clipboard == null) - throw new RuntimeException("Clipboard was null", new NoClipboardException()); + throw new NoClipboardException(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try{ @@ -97,18 +97,18 @@ class Schematic_14 { Clipboard clipboard = null; try { clipboard = getClipboard(is, schemFormat); - } catch (IOException | NoClipboardException e) { + } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } if (clipboard == null) - throw new RuntimeException("clipboard was null", new NoClipboardException()); + throw new NoClipboardException(); Actor actor = getWorldEditPlugin().wrapCommandSender(player); getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); } - static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException, NoClipboardException { + static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { try { if(schemFormat){ return new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is))).read(); diff --git a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java b/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java index 8578007..7461ec1 100644 --- a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java +++ b/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java @@ -57,12 +57,12 @@ class Schematic_8 { try { clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); } catch (EmptyClipboardException e) { - throw new RuntimeException(e.getMessage(), e); + throw new NoClipboardException(); } Clipboard clipboard = clipboardHolder.getClipboard(); if(clipboard == null) - throw new RuntimeException("clipboard was null", new NoClipboardException()); + throw new NoClipboardException(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { diff --git a/SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java b/SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java index f7b6bc2..9743348 100644 --- a/SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java +++ b/SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java @@ -19,5 +19,5 @@ package de.steamwar.sql; -public class NoClipboardException extends Exception { +public class NoClipboardException extends RuntimeException { }