-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Add elytra boost event, firework type and firework syntaxes #5956
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only gone through this class too distracted rn to do more
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other changes found, and concerns.
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/CondElytraBoostConsume.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprAttachedTo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprAttachedTo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find anything else to criticize so looks good to me.
src/main/java/org/skriptlang/skript/elements/fireworks/CondElytraBoostConsume.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/EffElytraBoostConsume.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/EffElytraBoostConsume.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprAttachedTo.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprAttachedTo.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprAttachedTo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/elements/fireworks/ExprFireworkFlownTime.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meant to RC but commented instead
…achedTo.java Co-authored-by: Ayham Al Ali <[email protected]>
bd134d0
to
3f08853
Compare
@Examples({ | ||
"on player elytra boost:", | ||
"\twill consume firework", | ||
"\tset to consume the firework" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid example
|
||
static { | ||
if (Skript.classExists("com.destroystokyo.paper.event.player.PlayerElytraBoostEvent")) | ||
Skript.registerCondition(CondElytraBoostConsume.class, "[event] (will [:not]|not:won't) consume [the] firework"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be forced to include what is consuming the firework:
"[the] (event|player) (will [:not]|not:won't) consume [the] firework"
if (!(event instanceof PlayerElytraBoostEvent)) | ||
return false; | ||
return isNegated() && !((PlayerElytraBoostEvent) event).shouldConsume(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!(event instanceof PlayerElytraBoostEvent)) | |
return false; | |
return isNegated() && !((PlayerElytraBoostEvent) event).shouldConsume(); | |
if (event instanceof PlayerElytraBoostEvent) | |
return ((PlayerElytraBoostEvent) event).shouldConsume() ^ isNegated(); | |
return false; |
@Examples({ | ||
"on player elytra boost:", | ||
"\twill consume firework", | ||
"\tset to consume the firework" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid example
|
||
static { | ||
if (Skript.classExists("com.destroystokyo.paper.event.player.PlayerElytraBoostEvent")) | ||
Skript.registerEffect(EffElytraBoostConsume.class, "[not:do not] consume firework", "set consum(e|ption of) firework to %boolean%"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set consume of firework
shouldn't be allowed.
also, what do you think about [un]cancel consumption of [the] firework
or something similar?
"How much time that the fireworks have been boosting the player in an <a href='events.html#elytra_boost'>elytra boost event</a>.", | ||
"Maximum is the same as time until detonation. Paper names them differently than Spigot." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"How much time that the fireworks have been boosting the player in an <a href='events.html#elytra_boost'>elytra boost event</a>.", | |
"Maximum is the same as time until detonation. Paper names them differently than Spigot." | |
"How long a fireworks has been boosting the player in an <a href='events.html#elytra_boost'>elytra boost event</a>.", | |
"Maximum is the same as time until detonation." |
Also, having maximum life time be the same as time until detonation is a poor naming scheme we shouldn't pass on. The maximum life time should be from the launch until detonation, and the time until detonation should be from the current moment until detonation.
return Timespan.fromTicks_i(detonate ? firework.getTicksToDetonate() : firework.getTicksFlown()); | ||
return Timespan.fromTicks_i(detonate ? firework.getMaxLife() : firework.getLife()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Timespan.fromTicks_i(detonate ? firework.getTicksToDetonate() : firework.getTicksFlown()); | |
return Timespan.fromTicks_i(detonate ? firework.getMaxLife() : firework.getLife()); | |
return Timespan.fromTicks(detonate ? firework.getTicksToDetonate() : firework.getTicksFlown()); | |
return Timespan.fromTicks(detonate ? firework.getMaxLife() : firework.getLife()); |
|
||
@Override | ||
public void change(Event event, @Nullable Object[] delta, ChangeMode mode) { | ||
long ticks = (mode == ChangeMode.DELETE || mode == ChangeMode.RESET) ? 0 : ((Timespan) delta[0]).getTicks_i(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long ticks = (mode == ChangeMode.DELETE || mode == ChangeMode.RESET) ? 0 : ((Timespan) delta[0]).getTicks_i(); | |
long ticks = (mode == ChangeMode.DELETE || mode == ChangeMode.RESET) ? 0 : ((Timespan) delta[0]).getTicks(); |
ticks = -ticks; | ||
case ADD: | ||
for (Firework firework : getExpr().getArray(event)) { | ||
long existing = convert(firework).getTicks_i(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long existing = convert(firework).getTicks_i(); | |
long existing = convert(firework).getTicks(); |
case DELETE: | ||
case RESET: | ||
for (Firework firework : getExpr().getArray(event)) { | ||
if (detonate) { | ||
if (PAPER) { | ||
firework.setTicksToDetonate((int) 20 * firework.getFireworkMeta().getPower()); | ||
} else { | ||
firework.setMaxLife((int) 20 * firework.getFireworkMeta().getPower()); | ||
} | ||
} else { | ||
if (PAPER) { | ||
firework.setTicksFlown((int) 20 * firework.getFireworkMeta().getPower()); | ||
} else { | ||
firework.setLife((int) 20 * firework.getFireworkMeta().getPower()); | ||
} | ||
} | ||
} | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is unintuitive.
Delete should not be a valid changer, in my opinion, or if it is, it should set the value to 0.
Reset can't reliably figure out what the lifespan should be, since it doesn't know how long it's flown already.
For that reason, Reset probably also shouldn't be valid, or if it is, it should set remaining time to the original amount and the ticks flown to 0.
closing due to inactivity |
Description
Target Minecraft Versions: 1.18 for some 1.19 for some
Requirements: Paper for some syntaxes
Related Issues: #5826