Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch/skwipt 3.0 #4

Merged
merged 13 commits into from
Mar 31, 2024
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ task testJar(type: ShadowJar) {

task jar(overwrite: true, type: ShadowJar) {
dependsOn checkAliases
archiveFileName = jarName ? 'Skript.jar' : jarName
archiveFileName = jarName ? 'Skwipt.jar' : jarName
from sourceSets.main.output
}

task build(overwrite: true, type: ShadowJar) {
archiveFileName = jarName ? 'Skript.jar' : jarName
archiveFileName = jarName ? 'Skwipt.jar' : jarName
from sourceSets.main.output
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'Skript'
50 changes: 25 additions & 25 deletions src/main/java/ch/njol/skript/ScriptLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public int compare(Script s1, Script s2) {
File f1 = s1.getConfig().getFile();
File f2 = s2.getConfig().getFile();
if (f1 == null || f2 == null)
throw new IllegalArgumentException("Scripts will null config files cannot be sorted.");
throw new IllegalArgumentException("Scwipts wiww nuww config fiwes cannot be sowted.");

File f1Parent = f1.getParentFile();
File f2Parent = f2.getParentFile();
Expand Down Expand Up @@ -187,7 +187,7 @@ private boolean isSubDir(File directory, File subDir) {
@Nullable
public static Script getScript(File file) {
if (!file.isFile())
throw new IllegalArgumentException("Something other than a file was provided.");
throw new IllegalArgumentException("Something othew than a fiwe was pwovided.");
for (Script script : loadedScripts) {
if (file.equals(script.getConfig().getFile()))
return script;
Expand All @@ -203,7 +203,7 @@ public static Script getScript(File file) {
*/
public static Set<Script> getScripts(File directory) {
if (!directory.isDirectory())
throw new IllegalArgumentException("Something other than a directory was provided.");
throw new IllegalArgumentException("Something othew than a diwectowy was pwovided.");
Set<Script> scripts = new HashSet<>();
//noinspection ConstantConditions - If listFiles still manages to return null, we should probably let the exception print
for (File file : directory.listFiles(loadedScriptFilter)) {
Expand Down Expand Up @@ -243,7 +243,7 @@ static void updateDisabledScripts(Path path) {
.forEach(disabledScripts::add);
} catch (Exception e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An error occurred while trying to update the list of disabled scripts!");
Skript.exception(e, "An ewwow occuwwed whiwe twying to update the wist of disabwed scwipts!");
}
}

Expand All @@ -265,7 +265,7 @@ static void updateDisabledScripts(Path path) {
* The {@link ThreadGroup} all async loaders belong to.
* @see AsyncLoaderThread
*/
private static final ThreadGroup asyncLoaderThreadGroup = new ThreadGroup("Skript async loaders");
private static final ThreadGroup asyncLoaderThreadGroup = new ThreadGroup("Skwipt async woadews");

/**
* All active {@link AsyncLoaderThread}s.
Expand Down Expand Up @@ -541,7 +541,7 @@ private static CompletableFuture<ScriptInfo> loadScripts(List<Config> configs, O
}
} catch (Exception e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An error occurred while trying to preLoad a Structure.");
Skript.exception(e, "An ewwow occuwwed whiwe twying to pwewoad a Stwuctuwe.");
pair.getFirst().getSecond().remove(structure);
return true;
}
Expand Down Expand Up @@ -569,7 +569,7 @@ private static CompletableFuture<ScriptInfo> loadScripts(List<Config> configs, O
}
} catch (Exception e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An error occurred while trying to load a Structure.");
Skript.exception(e, "An ewwow occuwwed whiwe twying to woad a Stwuctuwe.");
pair.getFirst().getSecond().remove(structure);
return true;
}
Expand All @@ -592,7 +592,7 @@ private static CompletableFuture<ScriptInfo> loadScripts(List<Config> configs, O
}
} catch (Exception e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An error occurred while trying to postLoad a Structure.");
Skript.exception(e, "An ewwow occuwwed whiwe twying to postwoad a Stwuctuwe.");
pair.getFirst().getSecond().remove(structure);
return true;
}
Expand Down Expand Up @@ -620,7 +620,7 @@ private static CompletableFuture<ScriptInfo> loadScripts(List<Config> configs, O
// Whenever you call this method, make sure to also call PreScriptLoadEvent
private static NonNullPair<Script, List<Structure>> loadScript(Config config) {
if (config.getFile() == null)
throw new IllegalArgumentException("A config must have a file to be loaded.");
throw new IllegalArgumentException("A config must have a fiwe to be woaded.");

ParserInstance parser = getParser();
List<Structure> structures = new ArrayList<>();
Expand All @@ -634,7 +634,7 @@ private static NonNullPair<Script, List<Structure>> loadScript(Config config) {
try (CountingLogHandler ignored = new CountingLogHandler(SkriptLogger.SEVERE).start()) {
for (Node cnode : config.getMainNode()) {
if (!(cnode instanceof SectionNode)) {
Skript.error("invalid line - all code has to be put into triggers");
Skript.error("invawid wine - aww code has to be put into twiggews");
continue;
}

Expand All @@ -647,11 +647,11 @@ private static NonNullPair<Script, List<Structure>> loadScript(Config config) {
continue;

if (Skript.logVeryHigh() && !Skript.debug())
Skript.info("loading trigger '" + line + "'");
Skript.info("woading twiggew '" + line + "'");

line = replaceOptions(line);

Structure structure = Structure.parse(line, node, "Can't understand this structure: " + line);
Structure structure = Structure.parse(line, node, "Can't undewstand dis stwuctuwe: " + line);

if (structure == null)
continue;
Expand All @@ -661,12 +661,12 @@ private static NonNullPair<Script, List<Structure>> loadScript(Config config) {

if (Skript.logHigh()) {
int count = structures.size();
Skript.info("loaded " + count + " structure" + (count == 1 ? "" : "s") + " from '" + config.getFileName() + "'");
Skript.info("woaded " + count + " stwuctuwe" + (count == 1 ? "" : "s") + " fwom '" + config.getFileName() + "'");
}
}
} catch (Exception e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "Could not load " + config.getFileName());
Skript.exception(e, "Couwd not woad " + config.getFileName());
} finally {
parser.setInactive();
}
Expand Down Expand Up @@ -719,7 +719,7 @@ private static List<Config> loadStructures(File directory) {
directory = directory.getCanonicalFile();
} catch (IOException e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An exception occurred while trying to get the canonical file of: " + directory);
Skript.exception(e, "An exception occuwwed whiwe twying to get the canonicaw fiwe of: " + directory);
return new ArrayList<>();
}

Expand Down Expand Up @@ -755,7 +755,7 @@ private static Config loadStructure(File file) {
file = file.getCanonicalFile();
} catch (IOException e) {
//noinspection ThrowableNotThrown
Skript.exception(e, "An exception occurred while trying to get the canonical file of: " + file);
Skript.exception(e, "An exception occuwwed whiwe twying to get the canonicaw fiwe of: " + file);
return null;
}

Expand All @@ -771,7 +771,7 @@ private static Config loadStructure(File file) {
.resolve(Skript.SCRIPTSFOLDER).relativize(file.toPath().toAbsolutePath()).toString();
return loadStructure(Files.newInputStream(file.toPath()), name);
} catch (IOException e) {
Skript.error("Could not load " + file.getName() + ": " + ExceptionUtils.toString(e));
Skript.error("Couwd not woad " + file.getName() + ": " + ExceptionUtils.toString(e));
}

return null;
Expand All @@ -796,7 +796,7 @@ private static Config loadStructure(InputStream source, String name) {
":"
);
} catch (IOException e) {
Skript.error("Could not load " + name + ": " + ExceptionUtils.toString(e));
Skript.error("Couwd not woad " + name + ": " + ExceptionUtils.toString(e));
}

return null;
Expand All @@ -816,9 +816,9 @@ public static ScriptInfo unloadScripts(Set<Script> scripts) {
// ensure unloaded scripts are not being unloaded
for (Script script : scripts) {
if (!loadedScripts.contains(script))
throw new SkriptAPIException("The script at '" + script.getConfig().getPath() + "' is not loaded!");
throw new SkriptAPIException("The scwipt at '" + script.getConfig().getPath() + "' is not woaded!");
if (script.getConfig().getFile() == null)
throw new IllegalArgumentException("A script must have a file to be unloaded.");
throw new IllegalArgumentException("A scwipt must have a fiwe to be unwoaded.");
}

ParserInstance parser = getParser();
Expand Down Expand Up @@ -935,23 +935,23 @@ public static ArrayList<TriggerItem> loadItems(SectionNode node) {

String subNodeKey = subNode.getKey();
if (subNodeKey == null)
throw new IllegalArgumentException("Encountered node with null key: '" + subNode + "'");
throw new IllegalArgumentException("Encountewed node with nuww key: '" + subNode + "'");
String expr = replaceOptions(subNodeKey);
if (!SkriptParser.validateLine(expr))
continue;

if (subNode instanceof SimpleNode) {
long start = System.currentTimeMillis();
Statement stmt = Statement.parse(expr, "Can't understand this condition/effect: " + expr);
Statement stmt = Statement.parse(expr, "Can't undewstand dis condition/effect: " + expr);
if (stmt == null)
continue;
long requiredTime = SkriptConfig.longParseTimeWarningThreshold.value().getMilliSeconds();
if (requiredTime > 0) {
long timeTaken = System.currentTimeMillis() - start;
if (timeTaken > requiredTime)
Skript.warning(
"The current line took a long time to parse (" + new Timespan(timeTaken) + ")."
+ " Avoid using long lines and use parentheses to create clearer instructions."
"The cuwwent wine took a wong time to pawse (" + new Timespan(timeTaken) + ")."
+ " Avoid using wong wines and use pawentheses to cweate cweawew instwuctions."
);
}

Expand All @@ -962,7 +962,7 @@ public static ArrayList<TriggerItem> loadItems(SectionNode node) {
} else if (subNode instanceof SectionNode) {
TypeHints.enterScope(); // Begin conditional type hints

Section section = Section.parse(expr, "Can't understand this section: " + expr, (SectionNode) subNode, items);
Section section = Section.parse(expr, "Can't undewstand dis section: " + expr, (SectionNode) subNode, items);
if (section == null)
continue;

Expand Down
Loading
Loading