Skip to content

Commit ae9205f

Browse files
authored
Merge branch 'dev/feature' into underscores
2 parents af061a5 + 29c6764 commit ae9205f

File tree

137 files changed

+2219
-1331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2219
-1331
lines changed

.github/workflows/archive-docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
jobs:
99
archive-docs:
1010
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
11-
needs: release-docs
1211
runs-on: ubuntu-latest
1312
steps:
1413
- name: Configure workflow

.github/workflows/java-11-builds.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/java-17-builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Java 17 CI (MC 1.17-1.20.4)
1+
name: Java 17 CI (MC 1.19.4-1.20.4)
22

33
on:
44
push:

.github/workflows/junit-11-builds.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/junit-17-builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: JUnit (MC 1.17-1.20.4)
1+
name: JUnit (MC 1.19.4-1.20.4)
22

33
on:
44
push:

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Skript requires **Spigot** to work. You heard it right, **CraftBukkit** does *no
1616
**Paper**, which is a fork of Spigot, is recommended; it is required for some
1717
parts of Skript to be available.
1818

19-
Skript supports only the **latest** patch versions of Minecraft 1.13+.
20-
For example, this means that 1.16.5 is supported, but 1.16.4 is *not*.
19+
Skript supports only the **latest** patch versions of Minecraft 1.19 and newer.
20+
For example, this means that 1.19.4 is supported, but 1.19.3 is *not*.
2121
Testing with all old patch versions is not feasible for us.
2222

2323
Minecraft 1.12 and earlier are not, and will not be supported. New Minecraft
@@ -77,15 +77,14 @@ Skript has some tests written in Skript. Running them requires a Minecraft
7777
server, but our build script will create one for you. Running the tests is easy:
7878

7979
```
80-
./gradlew (quickTest|skriptTest|skriptTestJava11|skriptTestJava17|skriptTestJava21)
80+
./gradlew (quickTest|skriptTest|skriptTestJava17|skriptTestJava21)
8181
```
8282

8383
<code>quickTest</code> runs the test suite on newest supported server version.
8484
<code>skriptTestJava21</code> (1.20.6+) runs the tests on Java 21 supported versions.
85-
<code>skriptTestJava17</code> (1.17-1.20.4) runs the tests on Java 17 supported versions.
86-
<code>skriptTestJava11</code> (1.13-1.16) runs the tests on Java 11 supported versions.
85+
<code>skriptTestJava17</code> (1.19.4-1.20.4) runs the tests on Java 17 supported versions.
8786
<code>skriptTest</code> runs the tests on all versions.
88-
That is, it runs skriptTestJava11, skriptTestJava17, and skriptTestJava21.
87+
That is, it runs skriptTestJava17, and skriptTestJava21.
8988

9089
By running the tests, you agree to Mojang's End User License Agreement.
9190

build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ task build(overwrite: true, type: ShadowJar) {
7070
from sourceSets.main.output
7171
}
7272

73-
// Excludes the tests for the build task. Should be using junit, junitJava17, junitJava11, skriptTest, quickTest.
73+
// Excludes the tests for the build task. Should be using junit, junitJava17, skriptTest, quickTest.
7474
// We do not want tests to run for building. That's time consuming and annoying. Especially in development.
7575
test {
7676
exclude '**/*'
@@ -233,11 +233,10 @@ void createTestTask(String name, String desc, String environments, int javaVersi
233233

234234
def java21 = 21
235235
def java17 = 17
236-
def java11 = 11
237236

238237
def latestEnv = 'java21/paper-1.21.0.json'
239238
def latestJava = java21
240-
def oldestJava = java11
239+
def oldestJava = java17
241240

242241
def latestJUnitEnv = 'java17/paper-1.20.4.json'
243242
def latestJUnitJava = java17
@@ -260,25 +259,23 @@ int envJava = project.property('testEnvJavaVersion') == null ? latestJava : Inte
260259
createTestTask('quickTest', 'Runs tests on one environment being the latest supported Java and Minecraft.', environments + latestEnv, latestJava, 0)
261260
createTestTask('skriptTestJava21', 'Runs tests on all Java 21 environments.', environments + 'java21', java21, 0)
262261
createTestTask('skriptTestJava17', 'Runs tests on all Java 17 environments.', environments + 'java17', java17, 0)
263-
createTestTask('skriptTestJava11', 'Runs tests on all Java 11 environments.', environments + 'java11', java11, 0)
264262
createTestTask('skriptTestDev', 'Runs testing server and uses \'system.in\' for command input, stop server to finish.', environments + env, envJava, 0, Modifiers.DEV_MODE, Modifiers.DEBUG)
265263
createTestTask('skriptProfile', 'Starts the testing server with JProfiler support.', environments + latestEnv, latestJava, -1, Modifiers.PROFILE)
266264
createTestTask('genNightlyDocs', 'Generates the Skript documentation website html files.', environments + env, envJava, 0, Modifiers.GEN_NIGHTLY_DOCS)
267265
createTestTask('genReleaseDocs', 'Generates the Skript documentation website html files for a release.', environments + env, envJava, 0, Modifiers.GEN_RELEASE_DOCS)
268266
tasks.register('skriptTest') {
269267
description = 'Runs tests on all environments.'
270-
dependsOn skriptTestJava11, skriptTestJava17, skriptTestJava21
268+
dependsOn skriptTestJava17, skriptTestJava21
271269
}
272270

273271
createTestTask('JUnitQuick', 'Runs JUnit tests on one environment being the latest supported Java and Minecraft.', environments + latestJUnitEnv, latestJUnitJava, 0, Modifiers.JUNIT)
274272
// Disabled as EasyMock 5.2.0 is required for Java 21 support
275273
// However, we are currently using 5.0.1 (see https://github.com/SkriptLang/Skript/pull/6204#discussion_r1405302009)
276274
//createTestTask('JUnitJava21', 'Runs JUnit tests on all Java 21 environments.', environments + 'java21', java21, 0, Modifiers.JUNIT)
277275
createTestTask('JUnitJava17', 'Runs JUnit tests on all Java 17 environments.', environments + 'java17', java17, 0, Modifiers.JUNIT)
278-
createTestTask('JUnitJava11', 'Runs JUnit tests on all Java 11 environments.', environments + 'java11', java11, 0, Modifiers.JUNIT)
279276
tasks.register('JUnit') {
280277
description = 'Runs JUnit tests on all environments.'
281-
dependsOn JUnitJava11, JUnitJava17//, JUnitJava21
278+
dependsOn JUnitJava17//, JUnitJava21
282279
}
283280

284281
// Build flavor configurations

code-conventions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,8 @@ Your comments should look something like these:
194194
## Language Features
195195

196196
### Compatibility
197-
[//]: # (To be updated for 2.10 for Java 17)
198-
* Contributions should maintain Java 11 source/binary compatibility, even though compiling Skript requires Java 21
199-
- Users must not need JRE newer than version 11
197+
* Contributions should maintain Java 17 source/binary compatibility, even though compiling Skript requires Java 21
198+
- Users must not need JRE newer than version 17
200199
* Versions up to and including Java 21 should work too
201200
- Please avoid using unsafe reflection
202201
* It is recommended to make fields final, if they are effectively final

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.parallel=true
55

66
groupid=ch.njol
77
name=skript
8-
version=2.9.0-pre1
8+
version=2.9.1
99
jarName=Skript.jar
1010
testEnv=java21/paper-1.21.0
1111
testEnvJavaVersion=21

src/main/java/ch/njol/skript/Skript.java

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import ch.njol.skript.events.EvtSkript;
3535
import ch.njol.skript.hooks.Hook;
3636
import ch.njol.skript.lang.Condition;
37+
import ch.njol.skript.lang.Condition.ConditionType;
3738
import ch.njol.skript.lang.Effect;
3839
import ch.njol.skript.lang.Expression;
3940
import ch.njol.skript.lang.ExpressionInfo;
@@ -85,8 +86,10 @@
8586
import ch.njol.util.StringUtils;
8687
import ch.njol.util.coll.iterator.CheckedIterator;
8788
import ch.njol.util.coll.iterator.EnumerationIterable;
89+
8890
import com.google.common.collect.Lists;
8991
import com.google.gson.Gson;
92+
9093
import org.bstats.bukkit.Metrics;
9194
import org.bstats.charts.SimplePie;
9295
import org.bukkit.Bukkit;
@@ -1375,23 +1378,55 @@ public static SkriptAddon getAddonInstance() {
13751378

13761379
// ================ CONDITIONS & EFFECTS & SECTIONS ================
13771380

1378-
private static final Collection<SyntaxElementInfo<? extends Condition>> conditions = new ArrayList<>(50);
1379-
private static final Collection<SyntaxElementInfo<? extends Effect>> effects = new ArrayList<>(50);
1380-
private static final Collection<SyntaxElementInfo<? extends Statement>> statements = new ArrayList<>(100);
1381-
private static final Collection<SyntaxElementInfo<? extends Section>> sections = new ArrayList<>(50);
1381+
private static final List<SyntaxElementInfo<? extends Condition>> conditions = new ArrayList<>(50);
1382+
private static final List<SyntaxElementInfo<? extends Effect>> effects = new ArrayList<>(50);
1383+
private static final List<SyntaxElementInfo<? extends Statement>> statements = new ArrayList<>(100);
1384+
private static final List<SyntaxElementInfo<? extends Section>> sections = new ArrayList<>(50);
1385+
1386+
public static Collection<SyntaxElementInfo<? extends Statement>> getStatements() {
1387+
return statements;
1388+
}
1389+
1390+
public static Collection<SyntaxElementInfo<? extends Effect>> getEffects() {
1391+
return effects;
1392+
}
1393+
1394+
public static Collection<SyntaxElementInfo<? extends Section>> getSections() {
1395+
return sections;
1396+
}
1397+
1398+
// ================ CONDITIONS ================
1399+
public static Collection<SyntaxElementInfo<? extends Condition>> getConditions() {
1400+
return conditions;
1401+
}
1402+
1403+
private final static int[] conditionTypesStartIndices = new int[ConditionType.values().length];
13821404

13831405
/**
13841406
* registers a {@link Condition}.
13851407
*
13861408
* @param condition The condition's class
13871409
* @param patterns Skript patterns to match this condition
13881410
*/
1389-
public static <E extends Condition> void registerCondition(final Class<E> condition, final String... patterns) throws IllegalArgumentException {
1411+
public static <E extends Condition> void registerCondition(Class<E> condition, String... patterns) throws IllegalArgumentException {
1412+
registerCondition(condition, ConditionType.COMBINED, patterns);
1413+
}
1414+
1415+
/**
1416+
* registers a {@link Condition}.
1417+
*
1418+
* @param condition The condition's class
1419+
* @param type The conditions {@link ConditionType type}. This is used to determine in which order to try to parse conditions.
1420+
* @param patterns Skript patterns to match this condition
1421+
*/
1422+
public static <E extends Condition> void registerCondition(Class<E> condition, ConditionType type, String... patterns) throws IllegalArgumentException {
13901423
checkAcceptRegistrations();
13911424
String originClassPath = Thread.currentThread().getStackTrace()[2].getClassName();
13921425
final SyntaxElementInfo<E> info = new SyntaxElementInfo<>(patterns, condition, originClassPath);
1393-
conditions.add(info);
1394-
statements.add(info);
1426+
conditions.add(conditionTypesStartIndices[type.ordinal()], info);
1427+
statements.add(conditionTypesStartIndices[type.ordinal()], info);
1428+
for (int i = type.ordinal(); i < ConditionType.values().length; i++)
1429+
conditionTypesStartIndices[i]++;
13951430
}
13961431

13971432
/**
@@ -1422,22 +1457,6 @@ public static <E extends Section> void registerSection(Class<E> section, String.
14221457
sections.add(info);
14231458
}
14241459

1425-
public static Collection<SyntaxElementInfo<? extends Statement>> getStatements() {
1426-
return statements;
1427-
}
1428-
1429-
public static Collection<SyntaxElementInfo<? extends Condition>> getConditions() {
1430-
return conditions;
1431-
}
1432-
1433-
public static Collection<SyntaxElementInfo<? extends Effect>> getEffects() {
1434-
return effects;
1435-
}
1436-
1437-
public static Collection<SyntaxElementInfo<? extends Section>> getSections() {
1438-
return sections;
1439-
}
1440-
14411460
// ================ EXPRESSIONS ================
14421461

14431462
private final static List<ExpressionInfo<?, ?>> expressions = new ArrayList<>(100);

0 commit comments

Comments
 (0)