diff --git a/src/main/java/ch/njol/skript/ScriptLoader.java b/src/main/java/ch/njol/skript/ScriptLoader.java index 14cd0b3e628..3fa8c855c32 100644 --- a/src/main/java/ch/njol/skript/ScriptLoader.java +++ b/src/main/java/ch/njol/skript/ScriptLoader.java @@ -516,67 +516,89 @@ private static CompletableFuture loadScripts(List configs, O try { openCloseable.open(); - scripts.stream() - .flatMap(pair -> { // Flatten each entry down to a stream of Script-Structure pairs - return pair.getSecond().stream() - .map(structure -> new NonNullPair<>(pair, structure)); - }) - .sorted(Comparator.comparing(pair -> pair.getSecond().getPriority())) - .forEach(pair -> { - Script script = pair.getFirst().getFirst(); - Structure structure = pair.getSecond(); - - parser.setActive(script); - parser.setCurrentStructure(structure); - parser.setNode(structure.getEntryContainer().getSource()); - - try { - if (!structure.preLoad()) - pair.getFirst().getSecond().remove(structure); - } catch (Exception e) { - //noinspection ThrowableNotThrown - Skript.exception(e, "An error occurred while trying to load a Structure."); + // build sorted list + // this nest of pairs is terrible, but we need to keep the reference to the modifiable structures list + List>, Structure>> pairs = scripts.stream() + .flatMap(pair -> { // Flatten each entry down to a stream of Script-Structure pairs + return pair.getSecond().stream() + .map(structure -> new NonNullPair<>(pair, structure)); + }) + .sorted(Comparator.comparing(pair -> pair.getSecond().getPriority())) + .collect(Collectors.toCollection(ArrayList::new)); + + // pre-loading + pairs.removeIf(pair -> { + Structure structure = pair.getSecond(); + + parser.setActive(pair.getFirst().getFirst()); + parser.setCurrentStructure(structure); + parser.setNode(structure.getEntryContainer().getSource()); + + try { + if (!structure.preLoad()) { pair.getFirst().getSecond().remove(structure); + return true; } - }); - + } catch (Exception e) { + //noinspection ThrowableNotThrown + Skript.exception(e, "An error occurred while trying to preLoad a Structure."); + pair.getFirst().getSecond().remove(structure); + return true; + } + return false; + }); parser.setInactive(); - // TODO in the future, Structure#load should be split across multiple threads if parallel loading is enabled. + // TODO in the future, Structure#load/Structure#postLoad should be split across multiple threads if parallel loading is enabled. // However, this is not possible right now as reworks in multiple areas will be needed. // For example, the "Commands" class still uses a static list for currentArguments that is cleared between loads. // Until these reworks happen, limiting main loading to asynchronous (not parallel) is the only choice we have. - for (NonNullPair> pair : scripts) { - parser.setActive(pair.getFirst()); - pair.getSecond().removeIf(structure -> { - parser.setCurrentStructure(structure); - parser.setNode(structure.getEntryContainer().getSource()); - try { - return !structure.load(); - } catch (Exception e) { - //noinspection ThrowableNotThrown - Skript.exception(e, "An error occurred while trying to load a Structure."); + + // loading + pairs.removeIf(pair -> { + Structure structure = pair.getSecond(); + + parser.setActive(pair.getFirst().getFirst()); + parser.setCurrentStructure(structure); + parser.setNode(structure.getEntryContainer().getSource()); + + try { + if (!structure.load()) { + pair.getFirst().getSecond().remove(structure); return true; } - }); - } - + } catch (Exception e) { + //noinspection ThrowableNotThrown + Skript.exception(e, "An error occurred while trying to load a Structure."); + pair.getFirst().getSecond().remove(structure); + return true; + } + return false; + }); parser.setInactive(); - for (NonNullPair> pair : scripts) { - parser.setActive(pair.getFirst()); - pair.getSecond().removeIf(structure -> { - parser.setCurrentStructure(structure); - parser.setNode(structure.getEntryContainer().getSource()); - try { - return !structure.postLoad(); - } catch (Exception e) { - //noinspection ThrowableNotThrown - Skript.exception(e, "An error occurred while trying to load a Structure."); + // post-loading + pairs.removeIf(pair -> { + Structure structure = pair.getSecond(); + + parser.setActive(pair.getFirst().getFirst()); + parser.setCurrentStructure(structure); + parser.setNode(structure.getEntryContainer().getSource()); + + try { + if (!structure.postLoad()) { + pair.getFirst().getSecond().remove(structure); return true; } - }); - } + } catch (Exception e) { + //noinspection ThrowableNotThrown + Skript.exception(e, "An error occurred while trying to postLoad a Structure."); + pair.getFirst().getSecond().remove(structure); + return true; + } + return false; + }); + parser.setInactive(); return scriptInfo; } catch (Exception e) { @@ -593,7 +615,7 @@ private static CompletableFuture loadScripts(List configs, O /** * Creates a script and loads the provided config into it. * @param config The config to load into a script. - * @return The script that was loaded. + * @return A pair containing the script that was loaded and a modifiable version of the structures list. */ // Whenever you call this method, make sure to also call PreScriptLoadEvent private static NonNullPair> loadScript(Config config) { @@ -1009,20 +1031,6 @@ public static FileFilter getDisabledScriptsFilter() { * by new methods in this class. */ - /** - * Reloads a single script. - * @param scriptFile The file representing the script to reload. - * @return Future of statistics of the newly loaded script. - * @deprecated Use {@link #reloadScript(Script, OpenCloseable)}. - */ - @Deprecated - public static CompletableFuture reloadScript(File scriptFile, OpenCloseable openCloseable) { - Script script = getScript(scriptFile); - if (script == null) - return CompletableFuture.completedFuture(new ScriptInfo()); - return reloadScript(script, openCloseable); - } - /** * Unloads the provided script. * @param scriptFile The file representing the script to unload. @@ -1049,6 +1057,18 @@ private static ScriptInfo unloadScripts(File folder) { return unloadScripts(getScripts(folder)); } + /** + * Reloads a single script. + * @param scriptFile The file representing the script to reload. + * @return Future of statistics of the newly loaded script. + * @deprecated Use {@link #reloadScript(Script, OpenCloseable)}. + */ + @Deprecated + public static CompletableFuture reloadScript(File scriptFile, OpenCloseable openCloseable) { + unloadScript(scriptFile); + return loadScripts(scriptFile, openCloseable); + } + /** * Reloads all scripts in the given folder and its subfolders. * @param folder A folder. @@ -1058,7 +1078,7 @@ private static ScriptInfo unloadScripts(File folder) { @Deprecated public static CompletableFuture reloadScripts(File folder, OpenCloseable openCloseable) { unloadScripts(folder); - return loadScripts(loadStructures(folder), openCloseable); + return loadScripts(folder, openCloseable); } /** diff --git a/src/main/java/ch/njol/skript/structures/StructCommand.java b/src/main/java/ch/njol/skript/structures/StructCommand.java index 0b86f6762f8..540e653bb49 100644 --- a/src/main/java/ch/njol/skript/structures/StructCommand.java +++ b/src/main/java/ch/njol/skript/structures/StructCommand.java @@ -96,7 +96,7 @@ public class StructCommand extends Structure { .addEntry("description", "", true) .addEntry("prefix", null, true) .addEntry("permission", "", true) - .addEntryData(new VariableStringEntryData("permission message", null, true, ScriptCommandEvent.class)) + .addEntryData(new VariableStringEntryData("permission message", null, true)) .addEntryData(new KeyValueEntryData>("aliases", new ArrayList<>(), true) { private final Pattern pattern = Pattern.compile("\\s*,\\s*/?"); @@ -131,9 +131,9 @@ protected Integer getValue(String value) { } }) .addEntryData(new LiteralEntryData<>("cooldown", null, true, Timespan.class)) - .addEntryData(new VariableStringEntryData("cooldown message", null, true, ScriptCommandEvent.class)) + .addEntryData(new VariableStringEntryData("cooldown message", null, true)) .addEntry("cooldown bypass", null, true) - .addEntryData(new VariableStringEntryData("cooldown storage", null, true, StringMode.VARIABLE_NAME, ScriptCommandEvent.class)) + .addEntryData(new VariableStringEntryData("cooldown storage", null, true, StringMode.VARIABLE_NAME)) .addSection("trigger", false) .unexpectedEntryMessage(key -> "Unexpected entry '" + key + "'. Check that it's spelled correctly, and ensure that you have put all code into a trigger." @@ -152,7 +152,6 @@ public boolean init(Literal[] args, int matchedPattern, ParseResult parseResu } @Override - @SuppressWarnings("unchecked") public boolean load() { getParser().setCurrentEvent("command", ScriptCommandEvent.class); @@ -272,8 +271,8 @@ public boolean load() { if (permissionMessage != null && permission.isEmpty()) Skript.warning("command /" + command + " has a permission message set, but not a permission"); - List aliases = (List) entryContainer.get("aliases", true); - int executableBy = (Integer) entryContainer.get("executable by", true); + List aliases = entryContainer.get("aliases", List.class,true); + int executableBy = entryContainer.get("executable by", Integer.class, true); Timespan cooldown = entryContainer.getOptional("cooldown", Timespan.class, false); VariableString cooldownMessage = entryContainer.getOptional("cooldown message", VariableString.class, false); diff --git a/src/main/java/ch/njol/skript/structures/StructOptions.java b/src/main/java/ch/njol/skript/structures/StructOptions.java index 574592e5c96..3f414fb59bd 100644 --- a/src/main/java/ch/njol/skript/structures/StructOptions.java +++ b/src/main/java/ch/njol/skript/structures/StructOptions.java @@ -32,6 +32,7 @@ import org.bukkit.event.Event; import org.jetbrains.annotations.Nullable; import org.skriptlang.skript.lang.entry.EntryContainer; +import org.skriptlang.skript.lang.script.Script; import org.skriptlang.skript.lang.script.ScriptData; import org.skriptlang.skript.lang.structure.Structure; @@ -75,20 +76,16 @@ public class StructOptions extends Structure { public boolean init(Literal[] args, int matchedPattern, ParseResult parseResult, EntryContainer entryContainer) { SectionNode node = entryContainer.getSource(); node.convertToEntries(-1); - - OptionsData optionsData = new OptionsData(); - loadOptions(node, "", optionsData.options); - getParser().getCurrentScript().addData(optionsData); - + loadOptions(node, "", getParser().getCurrentScript().getData(OptionsData.class, OptionsData::new).options); return true; } private void loadOptions(SectionNode sectionNode, String prefix, Map options) { - for (Node n : sectionNode) { - if (n instanceof EntryNode) { - options.put(prefix + n.getKey(), ((EntryNode) n).getValue()); - } else if (n instanceof SectionNode) { - loadOptions((SectionNode) n, prefix + n.getKey() + ".", options); + for (Node node : sectionNode) { + if (node instanceof EntryNode) { + options.put(prefix + node.getKey(), ((EntryNode) node).getValue()); + } else if (node instanceof SectionNode) { + loadOptions((SectionNode) node, prefix + node.getKey() + ".", options); } else { Skript.error("Invalid line in options"); } @@ -111,7 +108,7 @@ public Priority getPriority() { } @Override - public String toString(@Nullable Event e, boolean debug) { + public String toString(@Nullable Event event, boolean debug) { return "options"; } diff --git a/src/main/java/org/skriptlang/skript/lang/entry/EntryContainer.java b/src/main/java/org/skriptlang/skript/lang/entry/EntryContainer.java index bc277094db6..c613b7fbffc 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/EntryContainer.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/EntryContainer.java @@ -89,11 +89,11 @@ public List getUnhandledNodes() { * @return The entry's value. * @throws RuntimeException If the entry's value is null, or if it is not of the expected type. */ - public T get(String key, Class expectedType, boolean useDefaultValue) { - T parsed = getOptional(key, expectedType, useDefaultValue); - if (parsed == null) + public R get(String key, Class expectedType, boolean useDefaultValue) { + R value = getOptional(key, expectedType, useDefaultValue); + if (value == null) throw new RuntimeException("Null value for asserted non-null value"); - return parsed; + return value; } /** @@ -124,13 +124,13 @@ public Object get(String key, boolean useDefaultValue) { */ @Nullable @SuppressWarnings("unchecked") - public T getOptional(String key, Class expectedType, boolean useDefaultValue) { + public R getOptional(String key, Class expectedType, boolean useDefaultValue) { Object parsed = getOptional(key, useDefaultValue); if (parsed == null) return null; if (!expectedType.isInstance(parsed)) throw new RuntimeException("Expected entry with key '" + key + "' to be '" + expectedType + "', but got '" + parsed.getClass() + "'"); - return (T) parsed; + return (R) parsed; } /** diff --git a/src/main/java/org/skriptlang/skript/lang/entry/util/ExpressionEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/util/ExpressionEntryData.java index 7dbd560731b..e707d3337d3 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/util/ExpressionEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/util/ExpressionEntryData.java @@ -21,74 +21,63 @@ import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.ParseContext; import ch.njol.skript.lang.SkriptParser; -import ch.njol.skript.lang.parser.ParserInstance; -import org.skriptlang.skript.lang.entry.KeyValueEntryData; -import ch.njol.util.Kleenean; -import org.bukkit.event.Event; +import ch.njol.skript.localization.Message; +import ch.njol.skript.log.ErrorQuality; +import ch.njol.skript.log.ParseLogHandler; import org.eclipse.jdt.annotation.Nullable; +import org.skriptlang.skript.lang.entry.KeyValueEntryData; /** * A type of {@link KeyValueEntryData} designed to parse its value as an {@link Expression}. * This data CAN return null if expression parsing fails. + * Note that it will print an error. */ public class ExpressionEntryData extends KeyValueEntryData> { + private static final Message M_IS = new Message("is"); + private final Class returnType; private final int flags; - - private final Class[] events; /** * @param returnType The expected return type of the matched expression. - * @param events Events to be present during parsing and Trigger execution. - * This allows the usage of event-restricted syntax and event-values. - * @see ParserInstance#setCurrentEvents(Class[]) */ - @SafeVarargs public ExpressionEntryData( String key, @Nullable Expression defaultValue, boolean optional, - Class returnType, Class... events + Class returnType ) { - this(key, defaultValue, optional, returnType, SkriptParser.ALL_FLAGS, events); + this(key, defaultValue, optional, returnType, SkriptParser.ALL_FLAGS); } /** * @param returnType The expected return type of the matched expression. * @param flags Parsing flags. See {@link SkriptParser#SkriptParser(String, int, ParseContext)} * javadoc for more details. - * @param events Events to be present during parsing and Trigger execution. - * This allows the usage of event-restricted syntax and event-values. - * @see ParserInstance#setCurrentEvents(Class[]) */ - @SafeVarargs public ExpressionEntryData( String key, @Nullable Expression defaultValue, boolean optional, - Class returnType, int flags, Class... events + Class returnType, int flags ) { super(key, defaultValue, optional); this.returnType = returnType; this.flags = flags; - this.events = events; } @Override @Nullable @SuppressWarnings("unchecked") protected Expression getValue(String value) { - ParserInstance parser = ParserInstance.get(); - - Class[] oldEvents = parser.getCurrentEvents(); - Kleenean oldHasDelayBefore = parser.getHasDelayBefore(); - - parser.setCurrentEvents(events); - parser.setHasDelayBefore(Kleenean.FALSE); - - Expression expression = new SkriptParser(value, flags, ParseContext.DEFAULT).parseExpression(returnType); - - parser.setCurrentEvents(oldEvents); - parser.setHasDelayBefore(oldHasDelayBefore); - + Expression expression; + try (ParseLogHandler log = new ParseLogHandler()) { + expression = new SkriptParser(value, flags, ParseContext.DEFAULT) + .parseExpression(returnType); + if (expression == null) // print an error if it couldn't parse + log.printError( + "'" + value + "' " + M_IS + " " + SkriptParser.notOfType(returnType), + ErrorQuality.NOT_AN_EXPRESSION + ); + } return expression; } diff --git a/src/main/java/org/skriptlang/skript/lang/entry/util/LiteralEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/util/LiteralEntryData.java index 9b48a19e341..43e9932dc81 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/util/LiteralEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/util/LiteralEntryData.java @@ -38,7 +38,10 @@ public class LiteralEntryData extends KeyValueEntryData { /** * @param type The type to parse the value into. */ - public LiteralEntryData(String key, @Nullable T defaultValue, boolean optional, Class type) { + public LiteralEntryData( + String key, @Nullable T defaultValue, boolean optional, + Class type + ) { super(key, defaultValue, optional); this.type = type; } diff --git a/src/main/java/org/skriptlang/skript/lang/entry/util/TriggerEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/util/TriggerEntryData.java index b0a856e3756..a445dc438a4 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/util/TriggerEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/util/TriggerEntryData.java @@ -32,49 +32,25 @@ /** * An entry data class designed to take a {@link SectionNode} and parse it into a Trigger. - * Events specified during construction *should* be used when the Trigger is executed. * This data will NEVER return null. * @see SectionEntryData */ public class TriggerEntryData extends EntryData { - private final Class[] events; - - /** - * @param events Events to be present during parsing and Trigger execution. - * This allows the usage of event-restricted syntax and event-values. - * @see ParserInstance#setCurrentEvents(Class[]) - */ - @SafeVarargs - public TriggerEntryData( - String key, @Nullable Trigger defaultValue, boolean optional, - Class... events - ) { + public TriggerEntryData(String key, @Nullable Trigger defaultValue, boolean optional) { super(key, defaultValue, optional); - this.events = events; } @Nullable @Override public Trigger getValue(Node node) { assert node instanceof SectionNode; - - ParserInstance parser = ParserInstance.get(); - - Class[] oldEvents = parser.getCurrentEvents(); - Kleenean oldHasDelayBefore = parser.getHasDelayBefore(); - - parser.setCurrentEvents(events); - parser.setHasDelayBefore(Kleenean.FALSE); - - Trigger trigger = new Trigger( - parser.getCurrentScript(), "entry with key: " + getKey(), new SimpleEvent(), ScriptLoader.loadItems((SectionNode) node) + return new Trigger( + ParserInstance.get().getCurrentScript(), + "entry with key: " + getKey(), + new SimpleEvent(), + ScriptLoader.loadItems((SectionNode) node) ); - - parser.setCurrentEvents(oldEvents); - parser.setHasDelayBefore(oldHasDelayBefore); - - return trigger; } @Override diff --git a/src/main/java/org/skriptlang/skript/lang/entry/util/VariableStringEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/util/VariableStringEntryData.java index 57264fd0393..6a61e3642fa 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/util/VariableStringEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/util/VariableStringEntryData.java @@ -36,58 +36,34 @@ public class VariableStringEntryData extends KeyValueEntryData { private final StringMode stringMode; - private final Class[] events; - /** - * @param events Events to be present during parsing and Trigger execution. - * This allows the usage of event-restricted syntax and event-values. - * @see ParserInstance#setCurrentEvents(Class[]) + * Uses {@link StringMode#MESSAGE} as the default string mode. + * @see #VariableStringEntryData(String, VariableString, boolean, StringMode) */ - @SafeVarargs public VariableStringEntryData( - String key, @Nullable VariableString defaultValue, boolean optional, - Class... events + String key, @Nullable VariableString defaultValue, boolean optional ) { - this(key, defaultValue, optional, StringMode.MESSAGE, events); + this(key, defaultValue, optional, StringMode.MESSAGE); } /** * @param stringMode Sets how to parse the string (e.g. as a variable, message, etc.). - * @param events Events to be present during parsing and Trigger execution. - * This allows the usage of event-restricted syntax and event-values. - * @see ParserInstance#setCurrentEvents(Class[]) */ - @SafeVarargs public VariableStringEntryData( String key, @Nullable VariableString defaultValue, boolean optional, - StringMode stringMode, Class... events + StringMode stringMode ) { super(key, defaultValue, optional); this.stringMode = stringMode; - this.events = events; } @Override @Nullable protected VariableString getValue(String value) { - ParserInstance parser = ParserInstance.get(); - - Class[] oldEvents = parser.getCurrentEvents(); - Kleenean oldHasDelayBefore = parser.getHasDelayBefore(); - - parser.setCurrentEvents(events); - parser.setHasDelayBefore(Kleenean.FALSE); - // Double up quotations outside of expressions if (stringMode != StringMode.VARIABLE_NAME) value = VariableString.quote(value); - - VariableString variableString = VariableString.newInstance(value, stringMode); - - parser.setCurrentEvents(oldEvents); - parser.setHasDelayBefore(oldHasDelayBefore); - - return variableString; + return VariableString.newInstance(value, stringMode); } } diff --git a/src/main/java/org/skriptlang/skript/lang/script/Script.java b/src/main/java/org/skriptlang/skript/lang/script/Script.java index 888f53d71c5..ed3b1920474 100644 --- a/src/main/java/org/skriptlang/skript/lang/script/Script.java +++ b/src/main/java/org/skriptlang/skript/lang/script/Script.java @@ -103,33 +103,41 @@ public boolean suppressesWarning(ScriptWarning warning) { private final Map, ScriptData> scriptData = new ConcurrentHashMap<>(5); /** - * Clears the data stored for this script. - */ - public void clearData() { - scriptData.clear(); - } - - /** + * This API is experimental and subject to change. * Adds new ScriptData to this Script's data map. * @param data The data to add. */ + @ApiStatus.Experimental public void addData(ScriptData data) { scriptData.put(data.getClass(), data); } /** + * This API is experimental and subject to change. * Removes the ScriptData matching the specified data type. * @param dataType The type of the data to remove. */ + @ApiStatus.Experimental public void removeData(Class dataType) { scriptData.remove(dataType); } /** + * This API is experimental and subject to change. + * Clears the data stored for this script. + */ + @ApiStatus.Experimental + public void clearData() { + scriptData.clear(); + } + + /** + * This API is experimental and subject to change. * A method to obtain ScriptData matching the specified data type. * @param dataType The class representing the ScriptData to obtain. * @return ScriptData found matching the provided class, or null if no data is present. */ + @ApiStatus.Experimental @Nullable @SuppressWarnings("unchecked") public Type getData(Class dataType) { @@ -137,12 +145,14 @@ public Type getData(Class dataType) { } /** + * This API is experimental and subject to change. * A method that always obtains ScriptData matching the specified data type. * By using the mapping supplier, it will also add ScriptData of the provided type if it is not already present. * @param dataType The class representing the ScriptData to obtain. * @param mapper A supplier to create ScriptData of the provided type if such ScriptData is not already present. * @return Existing ScriptData found matching the provided class, or new data provided by the mapping function. */ + @ApiStatus.Experimental @SuppressWarnings("unchecked") public Value getData(Class dataType, Supplier mapper) { return (Value) scriptData.computeIfAbsent(dataType, clazz -> mapper.get()); @@ -153,42 +163,52 @@ public Value getData(Class dataType, private final Set eventHandlers = new HashSet<>(5); /** + * This API is experimental and subject to change. * Adds the provided event to this Script. * @param event The event to add. */ + @ApiStatus.Experimental public void registerEvent(ScriptEvent event) { eventHandlers.add(event); } /** + * This API is experimental and subject to change. * Adds the provided event to this Script. * @param eventType The type of event being added. This is useful for registering the event through lambdas. * @param event The event to add. */ + @ApiStatus.Experimental public void registerEvent(Class eventType, T event) { eventHandlers.add(event); } /** + * This API is experimental and subject to change. * Removes the provided event from this Script. * @param event The event to remove. */ + @ApiStatus.Experimental public void unregisterEvent(ScriptEvent event) { eventHandlers.remove(event); } /** + * This API is experimental and subject to change. * @return An unmodifiable set of all events. */ + @ApiStatus.Experimental @Unmodifiable public Set getEvents() { return Collections.unmodifiableSet(eventHandlers); } /** + * This API is experimental and subject to change. * @param type The type of events to get. * @return An unmodifiable set of all events of the specified type. */ + @ApiStatus.Experimental @Unmodifiable @SuppressWarnings("unchecked") public Set getEvents(Class type) { diff --git a/src/main/java/org/skriptlang/skript/lang/structure/Structure.java b/src/main/java/org/skriptlang/skript/lang/structure/Structure.java index 1a787c366a8..17de96e446c 100644 --- a/src/main/java/org/skriptlang/skript/lang/structure/Structure.java +++ b/src/main/java/org/skriptlang/skript/lang/structure/Structure.java @@ -130,15 +130,14 @@ public boolean preLoad() { /** * The second phase of Structure loading. - * During this phase, Structures are loaded script by script. - * The order they are loaded in for each script is based on the Structure's priority. + * During this phase, all Structures across all loading scripts are loaded with respect to their priorities. * @return Whether loading was successful. An error should be printed prior to returning false to specify the cause. */ public abstract boolean load(); /** * The third and final phase of Structure loading. - * The loading order and method is the same as {@link #load()}. + * During this phase, all Structures across all loading scripts are loaded with respect to their priorities. * This method is primarily designed for Structures that wish to execute actions after * most other Structures have finished loading. * @return Whether postLoading was successful. An error should be printed prior to returning false to specify the cause.