|
8 | 8 | import ch.njol.skript.lang.Expression; |
9 | 9 | import ch.njol.skript.lang.SkriptParser.ParseResult; |
10 | 10 | import ch.njol.skript.registrations.EventValues; |
11 | | -import ch.njol.skript.util.Getter; |
12 | 11 | import ch.njol.skript.util.Timespan; |
| 12 | +import ch.njol.skript.util.Timespan.TimePeriod; |
13 | 13 | import ch.njol.util.Kleenean; |
14 | 14 | import com.sovdee.skriptparticles.shapes.Shape; |
15 | 15 | import com.sovdee.skriptparticles.util.DynamicLocation; |
@@ -58,12 +58,7 @@ public class EffSecDrawShape extends DrawShapeEffectSection { |
58 | 58 | "[sync:sync[hronously]] draw [the] shape[s] [of] %shapes% [%-directions% %-locations/entities%] [to %-players%]", |
59 | 59 | "draw [the] shape[s] [of] %shapes% [%-directions% %-locations/entities%] [to %-players%] (duration:for) [duration] %timespan% [with (delay|refresh [rate]) [of] %-timespan%]" |
60 | 60 | ); |
61 | | - EventValues.registerEventValue(EffSecDrawShape.DrawEvent.class, Shape.class, new Getter<>() { |
62 | | - @Override |
63 | | - public Shape get(EffSecDrawShape.DrawEvent event) { |
64 | | - return event.getShape(); |
65 | | - } |
66 | | - }, EventValues.TIME_NOW); |
| 61 | + EventValues.registerEventValue(EffSecDrawShape.DrawEvent.class, Shape.class, DrawEvent::getShape, EventValues.TIME_NOW); |
67 | 62 | } |
68 | 63 |
|
69 | 64 | @Nullable |
@@ -91,8 +86,8 @@ protected void setupAsync(Event event, Collection<DynamicLocation> locations, Co |
91 | 86 | @Nullable Timespan duration = this.duration.getSingle(event); |
92 | 87 | if (delay == null || duration == null) return; |
93 | 88 |
|
94 | | - period = Math.max(delay.getTicks(), 1); |
95 | | - iterations = Math.max(duration.getTicks() / period, 1); |
| 89 | + period = Math.max(delay.getAs(TimePeriod.TICK), 1); |
| 90 | + iterations = Math.max(duration.getAs(TimePeriod.TICK) / period, 1); |
96 | 91 | } |
97 | 92 | AtomicLong currentIteration = new AtomicLong(0); |
98 | 93 | BukkitRunnable runnable = new BukkitRunnable() { |
|
0 commit comments