Skip to content

Commit 07d0391

Browse files
committed
2.14 compat
1 parent 896c90e commit 07d0391

File tree

10 files changed

+141
-546
lines changed

10 files changed

+141
-546
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
group 'com.sovdee'
88
project.ext.jomlVersion = "1.10.5"
99

10-
configurations.all {
10+
configurations.configureEach {
1111
resolutionStrategy.cacheChangingModulesFor 1, 'minutes'
1212
}
1313

@@ -22,8 +22,8 @@ repositories {
2222
}
2323

2424
dependencies {
25-
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
26-
compileOnly("com.github.SkriptLang:Skript:2.12.0")
25+
compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
26+
compileOnly("com.github.SkriptLang:Skript:2.14.0-pre1")
2727
implementation "org.joml:joml:${jomlVersion}"
2828
}
2929

@@ -42,7 +42,7 @@ javadoc {
4242
}
4343

4444
java {
45-
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
45+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
4646
}
4747

4848
tasks.register('copyJar', Copy) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = 1.3.5
1+
version = 1.4.0

src/main/java/com/sovdee/skriptparticles/elements/effects/EffDrawParticle.java

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

src/main/java/com/sovdee/skriptparticles/elements/expressions/ExprCustomParticle.java

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

src/main/java/com/sovdee/skriptparticles/elements/expressions/properties/ExprShapeLocations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"teleport player to random element of {_locations::*}",
3030
"",
3131
"# drawing the shape yourself: (skbee particle syntax)",
32-
"draw 1 dust using dustOptions(red, 1) at (particle locations of (circle of radius 10) centered at player)"
32+
"draw 1 red dust at (particle locations of (circle of radius 10) centered at player)"
3333
})
3434
@Since("1.0.0")
3535
public class ExprShapeLocations extends SimpleExpression<Location> {

src/main/java/com/sovdee/skriptparticles/elements/sections/EffSecDrawShape.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"synchronously draw the shape of a sphere with radius 1 at player's location",
4646
"",
4747
"draw the shape {_shape} at player's location:",
48-
"\tset event-shape's particle to dust using dustOption(red, 1)",
48+
"\tset event-shape's particle to red dust",
4949
"",
5050
"synchronously draw shape (a sphere with radius 1 and a cube with radius 1) at player's location:",
5151
"\tset event-shape's radius to 2",

src/main/java/com/sovdee/skriptparticles/elements/sections/SecParticle.java

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import ch.njol.util.Kleenean;
1616
import com.sovdee.skriptparticles.particles.Particle;
1717
import com.sovdee.skriptparticles.particles.ParticleMotion;
18-
import com.sovdee.skriptparticles.util.ParticleUtil;
1918
import org.bukkit.event.Event;
2019
import org.bukkit.util.Vector;
2120
import org.checkerframework.checker.nullness.qual.Nullable;
21+
import org.skriptlang.skript.bukkit.particles.particleeffects.ParticleEffect;
2222
import org.skriptlang.skript.lang.entry.EntryContainer;
2323
import org.skriptlang.skript.lang.entry.EntryValidator;
2424
import org.skriptlang.skript.lang.entry.util.ExpressionEntryData;
@@ -35,7 +35,6 @@
3535
"\tvelocity: vector - the velocity of the particle. Can be a vector or a motion (inwards/clockwise/etc.). (default: 0, 0, 0)",
3636
"\textra: number - the extra value of the particle. Forces `count` to be 0 and cannot be combined with `offset`. " +
3737
"See the Minecraft wiki on /particle for more info. (default: 0)",
38-
"\tdata: object - the data value of the particle. For example, `dustOptions()` for the dust particle. See the Minecraft wiki on /particle for more info. (default: null)",
3938
"\tforce: boolean - whether or not to force the particle to be seen at long range. (default: false)"
4039
})
4140
@Examples({
@@ -46,12 +45,11 @@
4645
"\tforce: true",
4746
"set {_particle} to last created particle",
4847
"",
49-
"create a new custom dust particle with:",
48+
"create a new custom red dust particle with:",
5049
"\tcount: 0",
5150
"\tvelocity: inwards",
5251
"\textra: 0.5",
5352
"\tforce: true",
54-
"\tdata: dustOption(red, 5)",
5553
"set {_particle} to last created particle",
5654
})
5755
@Since("1.0.2")
@@ -63,7 +61,6 @@ public class SecParticle extends Section {
6361
.addEntryData(new ExpressionEntryData<>("offset", null, true, Vector.class))
6462
.addEntryData(new ExpressionEntryData<>("velocity", null, true, Object.class))
6563
.addEntryData(new ExpressionEntryData<>("extra", null, true, Number.class))
66-
.addEntryData(new ExpressionEntryData<>("data", null, true, Object.class))
6764
.addEntryData(new ExpressionEntryData<>("force", null, true, Boolean.class))
6865
.build();
6966

@@ -73,14 +70,13 @@ public class SecParticle extends Section {
7370
//- offset: vector
7471
//- velocity: vector or inwards/outwards (exclusive w/ offset & count)
7572
//- extra: double
76-
//- data: dustOptions, item, etc. (take skbee code)
7773
//- - if particle is dust, allow "color: color" and "size: double"
7874
//- force: boolean
7975
static {
8076
Skript.registerSection(SecParticle.class, "create [a] [new] custom %particle% [particle] [with]");
8177
}
8278

83-
private Expression<org.bukkit.Particle> particle;
79+
private Expression<ParticleEffect> particle;
8480
@Nullable
8581
private Expression<Number> count;
8682
@Nullable
@@ -90,8 +86,6 @@ public class SecParticle extends Section {
9086
@Nullable
9187
private Expression<Number> extra;
9288
@Nullable
93-
private Expression<Object> data;
94-
@Nullable
9589
private Expression<Boolean> force;
9690

9791
@SuppressWarnings("unchecked")
@@ -101,7 +95,7 @@ public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean is
10195
if (entryContainer == null)
10296
return false;
10397

104-
particle = (Expression<org.bukkit.Particle>) expressions[0];
98+
particle = (Expression<ParticleEffect>) expressions[0];
10599
count = (Expression<Number>) entryContainer.getOptional("count", Expression.class, true);
106100
offset = (Expression<Vector>) entryContainer.getOptional("offset", Expression.class, true);
107101
extra = (Expression<Number>) entryContainer.getOptional("extra", Expression.class, true);
@@ -116,15 +110,6 @@ public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean is
116110
}
117111
}
118112

119-
data = (Expression<Object>) entryContainer.getOptional("data", Expression.class, true);
120-
if (data != null) {
121-
data = LiteralUtils.defendExpression(data);
122-
if (!LiteralUtils.canInitSafely(data)){
123-
Skript.error("Invalid value for data! Must be a dust options, item, or other particle data!");
124-
return false;
125-
}
126-
}
127-
128113
if (offset != null && velocity != null) {
129114
Skript.error("You cannot have both an offset and a velocity for a particle!");
130115
return false;
@@ -141,18 +126,17 @@ protected TriggerItem walk(Event event) {
141126
}
142127

143128
private void execute(Event event) {
144-
org.bukkit. @Nullable Particle bukkitParticle = this.particle.getSingle(event);
145-
if (bukkitParticle == null)
129+
@Nullable ParticleEffect particleEffect = this.particle.getSingle(event);
130+
if (particleEffect == null)
146131
return;
147132
@Nullable Number count = this.count.getSingle(event);
148133
if (count == null)
149134
return;
150135
@Nullable Vector offset = this.offset != null ? this.offset.getSingle(event) : null;
151136
@Nullable Number extra = this.extra != null ? this.extra.getSingle(event) : null;
152-
@Nullable Object data = this.data != null ? this.data.getSingle(event) : null;
153137
@Nullable Boolean force = this.force != null ? this.force.getSingle(event) : null;
154138

155-
Particle particle = (Particle) new Particle(bukkitParticle).count(count.intValue());
139+
Particle particle = Particle.of(particleEffect).count(count.intValue());
156140

157141
if (velocity != null) {
158142
@Nullable Object v = velocity.getSingle(event);
@@ -169,12 +153,6 @@ private void execute(Event event) {
169153
if (extra != null)
170154
particle.extra(extra.doubleValue());
171155

172-
if (data != null) {
173-
data = ParticleUtil.getData(particle.particle(), data);
174-
if (data != null)
175-
particle.data(data);
176-
}
177-
178156
if (force != null)
179157
particle.force(force);
180158

0 commit comments

Comments
 (0)