From 26692d6633b742b2e8af398c883b111887529fd9 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 23 Jan 2023 13:27:08 +0100 Subject: [PATCH] Cleanup deprecated methods --- .../core/configuration/Settings.java | 16 ---- .../core/generator/HybridPlotWorld.java | 8 -- .../core/util/SchematicHandler.java | 96 ------------------- 3 files changed, 120 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 025c779ee..e3cb35bd1 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -433,22 +433,6 @@ public class Settings extends Config { } - - @Deprecated(forRemoval = true, since = "6.0.0") - @Comment("Schematic interface related settings") - public static class Web { - - @Comment({"The web interface for schematics", " - All schematics are anonymous and private", - " - Downloads can be deleted by the user", - " - Supports plot uploads, downloads and saves",}) - public static String URL = - "https://schem.intellectualsites.com/plots/"; - @Comment({"Whether or not the legacy web interface will be used for /plot download and /plot save", - "Note that this will be removed in future versions. Updating to Arkitektonika is highly suggested"}) - public static boolean LEGACY_WEBINTERFACE = false; - - } - @Comment("Schematic web interface related settings") public static class Arkitektonika { diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index efa145e54..2a7e8b4da 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -544,14 +544,6 @@ public class HybridPlotWorld extends ClassicPlotWorld { return schem1PopulationNeeded || schem2PopulationNeeded || schem3PopulationNeeded; } - /** - * @deprecated in favour of {@link HybridPlotWorld#getSchematicRoot()} - */ - @Deprecated(forRemoval = true, since = "6.9.0") - public File getRoot() { - return this.root; - } - /** * Get the root folder for this world's generation schematics. May be null if schematics not initialised via * {@link HybridPlotWorld#setupSchematics()} diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index f266a8114..d7822a280 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -120,84 +120,6 @@ public abstract class SchematicHandler { this.subscriberFactory = subscriberFactory; } - @Deprecated(forRemoval = true, since = "6.0.0") - public static void upload( - @Nullable UUID uuid, - final @Nullable String file, - final @NonNull String extension, - final @Nullable RunnableVal writeTask, - final @NonNull RunnableVal whenDone - ) { - if (writeTask == null) { - TaskManager.runTask(whenDone); - return; - } - final String filename; - final String website; - if (uuid == null) { - uuid = UUID.randomUUID(); - website = Settings.Web.URL + "upload.php?" + uuid; - filename = "plot." + extension; - } else { - website = Settings.Web.URL + "save.php?" + uuid; - filename = file + '.' + extension; - } - final URL url; - try { - url = new URL(Settings.Web.URL + "?key=" + uuid + "&type=" + extension); - } catch (MalformedURLException e) { - e.printStackTrace(); - whenDone.run(); - return; - } - TaskManager.runTaskAsync(() -> { - try { - String boundary = Long.toHexString(System.currentTimeMillis()); - URLConnection con = new URL(website).openConnection(); - con.setDoOutput(true); - con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); - try (OutputStream output = con.getOutputStream(); - PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8), true)) { - String CRLF = "\r\n"; - writer.append("--").append(boundary).append(CRLF); - writer.append("Content-Disposition: form-data; name=\"param\"").append(CRLF); - writer.append("Content-Type: text/plain; charset=").append(StandardCharsets.UTF_8.displayName()).append(CRLF); - String param = "value"; - writer.append(CRLF).append(param).append(CRLF).flush(); - writer.append("--").append(boundary).append(CRLF); - writer.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"").append(filename) - .append(String.valueOf('"')).append(CRLF); - writer.append("Content-Type: ").append(URLConnection.guessContentTypeFromName(filename)).append(CRLF); - writer.append("Content-Transfer-Encoding: binary").append(CRLF); - writer.append(CRLF).flush(); - writeTask.value = new AbstractDelegateOutputStream(output) { - @Override - public void close() { - } // Don't close - }; - writeTask.run(); - output.flush(); - writer.append(CRLF).flush(); - writer.append("--").append(boundary).append("--").append(CRLF).flush(); - } - String content; - try (Scanner scanner = new Scanner(con.getInputStream()).useDelimiter("\\A")) { - content = scanner.next().trim(); - } - if (!content.startsWith("<")) { - } - int responseCode = ((HttpURLConnection) con).getResponseCode(); - if (responseCode == 200) { - whenDone.value = url; - } - TaskManager.runTask(whenDone); - } catch (IOException e) { - e.printStackTrace(); - TaskManager.runTask(whenDone); - } - }); - } - public boolean exportAll( Collection collection, final File outputDir, @@ -514,24 +436,6 @@ public abstract class SchematicHandler { return null; } - @Deprecated(forRemoval = true, since = "6.0.0") - public void upload(final CompoundTag tag, UUID uuid, String file, RunnableVal whenDone) { - if (tag == null) { - TaskManager.runTask(whenDone); - return; - } - upload(uuid, file, "schem", new RunnableVal<>() { - @Override - public void run(OutputStream output) { - try (NBTOutputStream nos = new NBTOutputStream(new GZIPOutputStream(output, true))) { - nos.writeNamedTag("Schematic", tag); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - }, whenDone); - } - /** * Saves a schematic to a file path. *