Javadocs, cleanup, extension's client rules, built-in BundledModules generators, etc (#544)

* Add javadocs to many methods

* Added built-in ways to generate BundledModules and documented them

* Add Eclipse launch files to .gitignore and fix 11 warnings

* Remove many unused imports

* Remove some dead and unused code around app loading

* Allow extensions to have client-side rules in their SettingsManager

Also change tabs to spaces when those changed

* Remove unnecessary classloader param in BundledModule

* Change max tickwarp duration to Integer.MAX_VALUE

* Move RulePrinter into the source so it can be managed by the IDE

* Properly reset hopperCounters when changing worlds

Also change tabs to spaces again and minor tweaks to javadocs

* Run mergedocs even if Full.md was modified

* Update src/main/java/carpet/commands/TickCommand.java

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
altrisiandgnembon authored and GitHub committed 2020-11-16 09:30:59 -04:00
1 parent f444fab183
commit ba1071a8d1
35 files changed
+315 -91

No files matched your search

@@ -17,14 +17,46 @@ public class BundledModule extends Module
this.name = name;
this.code = code;
}
/**
* Creates a new {@link BundledModule} with an app located in Carpet's script storage.
* @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}
*/
public static BundledModule carpetNative(String scriptName, boolean isLibrary)
{
BundledModule module = new BundledModule(null, null, isLibrary);
try
{
module.name = scriptName.toLowerCase(Locale.ROOT);
return fromPath("assets/carpet/scripts/", scriptName, isLibrary);
}
/**
* Creates a new {@link BundledModule} with an app located at a specified place.
* @see #fromPathWithCustomName(ClassLoader, 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}
*/
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(ClassLoader, String, String, boolean)
*
* @param fullPath A {@link String} being the full path to the app's code, including file and extension.
* @param scriptName 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}
*/
public static BundledModule fromPathWithCustomName(String fullPath, String customName, boolean isLibrary) {
BundledModule module = new BundledModule(null, null, isLibrary);
try
{
module.name = customName.toLowerCase(Locale.ROOT);
module.code = IOUtils.toString(
BundledModule.class.getClassLoader().getResourceAsStream("assets/carpet/scripts/"+scriptName+(isLibrary?".scl":".sc")),
BundledModule.class.getClassLoader().getResourceAsStream(fullPath),
StandardCharsets.UTF_8
);
}