From b677cd73c8baab20df51a8134ce0359e36216e64 Mon Sep 17 00:00:00 2001 From: altrisi Date: Mon, 25 Jul 2022 22:35:24 +0200 Subject: [PATCH] Remove old deprecated `Module` type and subtypes They were deprecated in #1382 --- .../carpet/script/CarpetScriptServer.java | 17 ---- .../carpet/script/bundled/BundledModule.java | 78 ------------------- .../java/carpet/script/bundled/Module.java | 24 ------ 3 files changed, 119 deletions(-) delete mode 100644 src/main/java/carpet/script/bundled/BundledModule.java delete mode 100644 src/main/java/carpet/script/bundled/Module.java diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index aeee7876..d2e06639 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -68,23 +68,6 @@ public class CarpetScriptServer extends ScriptServer private static final List bundledModuleData = new ArrayList<>(); private static final List ruleModuleData = new ArrayList<>(); - - /** - * @deprecated Use {@link #registerBuiltInApp(Module)} instead - */ - @Deprecated(forRemoval = true) - public static void registerBuiltInScript(carpet.script.bundled.BundledModule app) - { - registerBuiltInApp(app.toModule()); - } - - /** - * @deprecated Use {@link #registerSettingsApp(Module)} instead - */ - @Deprecated(forRemoval = true) - public static void registerSettingsApp(carpet.script.bundled.BundledModule app) { - registerSettingsApp(app.toModule()); - } /** * Registers a Scarpet App to be always available under the {@code /script load} list. * @see Module#fromJarPath(String, String, boolean) diff --git a/src/main/java/carpet/script/bundled/BundledModule.java b/src/main/java/carpet/script/bundled/BundledModule.java deleted file mode 100644 index e53500ec..00000000 --- a/src/main/java/carpet/script/bundled/BundledModule.java +++ /dev/null @@ -1,78 +0,0 @@ -package carpet.script.bundled; - -/** - * @deprecated Use the static methods from {@link carpet.script.Module} instead. - * To be removed in first 1.20 snapshots - */ -@Deprecated(forRemoval = true) -public class BundledModule extends Module -{ - private String name; - private String code; - private boolean library; - /** - * @deprecated Use {@link carpet.script.Module} instead - */ - @Deprecated(forRemoval = true) - public BundledModule(String name, String code, boolean isLibrary) - { - library = isLibrary; - this.name = name; - this.code = code; - } - - /** - * Creates a new {@link BundledModule} with an app located at a specified place. - * @see #fromPathWithCustomName(String, String, boolean) - * - * @param path A {@link String} being the path to the directory where the app is located. - * @param scriptName A {@link String} being the name of the script. The extension will be autocompleted - * @param isLibrary A {@link boolean} indicating whether or not the script is a library - * @return The created {@link BundledModule} - * @deprecated Use {@link carpet.script.Module#fromJarPath(String, String, boolean)} - */ - @Deprecated(forRemoval = true) - public static BundledModule fromPath(String path, String scriptName, boolean isLibrary) { - return fromPathWithCustomName(path+scriptName+(isLibrary?".scl":".sc"), scriptName, isLibrary); - } - - /** - * Creates a new {@link BundledModule} with an app located at the specified fullPath with a custom name. - * @see #fromPath(String, String, boolean) - * - * @param fullPath A {@link String} being the full path to the app's code, including file and extension. - * @param customName A {@link String} being the custom name for the script. - * @param isLibrary A {@link boolean} indicating whether or not the script is a library - * @return The created {@link BundledModule} - * @deprecated Use {@link carpet.script.Module#fromJarPathWithCustomName(String, String, boolean)} - */ - @Deprecated(forRemoval = true) - public static BundledModule fromPathWithCustomName(String fullPath, String customName, boolean isLibrary) { - return new DelegatingBundledModule(carpet.script.Module.fromJarPathWithCustomName(fullPath, customName, isLibrary)); - } - - @Override - public boolean isLibrary() { return library; } - - @Override - public String getName() { return name; } - - @Override - public String getCode() { return code; } - - // BundledModule implementation that delegates to a modern Module, returned by the factory methods here - // Saves compute time and memory if extensions were storing their BundledModule and passing it to methods that - // convert it multiple times - private static class DelegatingBundledModule extends BundledModule { - private final carpet.script.Module module; - public DelegatingBundledModule(carpet.script.Module module) { - super(module.name(), module.code(), module.library()); - this.module = module; - } - - @Override - public carpet.script.Module toModule() { - return module; - } - } -} \ No newline at end of file diff --git a/src/main/java/carpet/script/bundled/Module.java b/src/main/java/carpet/script/bundled/Module.java deleted file mode 100644 index 0d818a0c..00000000 --- a/src/main/java/carpet/script/bundled/Module.java +++ /dev/null @@ -1,24 +0,0 @@ -package carpet.script.bundled; - -/** - * @deprecated Use {@link carpet.script.Module} instead. - * To be removed in first 1.20 snapshots - */ -@Deprecated(forRemoval = true) -public abstract class Module -{ - public abstract String getName(); - public abstract String getCode(); - public abstract boolean isLibrary(); - - public carpet.script.Module toModule() - { - return new carpet.script.Module(getName(), getCode(), isLibrary()); - } - - @Override - public int hashCode() - { - return getName().hashCode(); - } -}