-
-
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
Firework effect section #5542
Firework effect section #5542
Conversation
Co-authored-by: Ayham Al Ali <[email protected]>
Co-authored-by: Ayham Al Ali <[email protected]>
Co-authored-by: APickledWalrus <[email protected]>
Co-authored-by: APickledWalrus <[email protected]>
Co-authored-by: APickledWalrus <[email protected]>
Co-authored-by: Ayham Al Ali <[email protected]>
Co-authored-by: Ayham Al Ali <[email protected]>
Co-authored-by: APickledWalrus <[email protected]>
Co-authored-by: APickledWalrus <[email protected]>
- Change power variable to Integer instead of Number so Number#intValue only has to be called once. - Changed Consumer type to Firework instead of ? extends Firework to remove Consumer cast. - Added parentheses in toString message - added NotNull annotation to getHandlers method - Removed SuppressWarnings from walk since it's no longer needed
Co-authored-by: Ayham Al Ali <[email protected]>
bd134d0
to
3f08853
Compare
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.
Creating a local variable in the section does not carry over to the rest of the code.
The following should broadcast 2
:
command test:
trigger:
launch ball large colored red, green and white fading to light green and black at (player's location, player's location) with duration 1:
add 1 to {_test2}
broadcast "a"
broadcast "%{_test2}%"
[15:49:58 INFO]: Sahvde issued server command: /test
[15:49:58 INFO]: a
[15:49:58 INFO]: a
[15:49:58 INFO]: <none>
EffSecSpawn also doesn't handle this properly, but in a different way. See #6032
Closing due to 6+ months of inactivity. |
"\ttrigger:", | ||
"\t\tlaunch a firework with effects ball large coloured red at player:", | ||
"\t\t\tset metadata value \"cancel damage\" of event-entity to true", |
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.
"\ttrigger:", | |
"\t\tlaunch a firework with effects ball large coloured red at player:", | |
"\t\t\tset metadata value \"cancel damage\" of event-entity to true", | |
"\ttrigger:", | |
"\t\tlaunch a firework with effects ball large coloured red at player:", | |
"\t\t\tset metadata value \"cancel damage\" of event-entity to true", |
@@ -157,7 +159,7 @@ public String toString(@Nullable Event event, boolean debug) { | |||
default: | |||
assert false; | |||
} | |||
return "the last " + word + " " + type; | |||
return "last " + word + " " + type; |
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 "last " + word + " " + type; | |
return "the last " + word + " " + type; |
it's better to be verbose for toString IMO
if (sectionNode != null) | ||
trigger = loadCode(sectionNode, "firework launch", FireworkSectionLaunchEvent.class); |
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.
It would be good to include the logic from EffSecSpawn that forbids delays.
Skript/src/main/java/ch/njol/skript/sections/EffSecSpawn.java
Lines 125 to 133 in 0355df1
if (sectionNode != null) { | |
AtomicBoolean delayed = new AtomicBoolean(false); | |
Runnable afterLoading = () -> delayed.set(!getParser().getHasDelayBefore().isFalse()); | |
trigger = loadCode(sectionNode, "spawn", afterLoading, SpawnEvent.class); | |
if (delayed.get()) { | |
Skript.error("Delays can't be used within a Spawn Effect Section"); | |
return false; | |
} | |
} |
public String toString(@Nullable Event event, boolean debug) { | ||
return "launch fireworks " + effects.toString(event, debug) + | ||
" at " + locations.toString(event, debug) + | ||
" timed " + (power != null ? power.toString(event, debug) : "1"); |
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.
" timed " + (power != null ? power.toString(event, debug) : "1"); | |
" with duration " + (power != null ? power.toString(event, debug) : "1"); |
I think duration is a more familiar term for fireworks
World world = location.getWorld(); | ||
if (world == null) | ||
continue; | ||
@SuppressWarnings("deprecation") |
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.
should likely be a //noinspection deprecation
Closing due to inactivity |
Description
Pull request taking over from stale #4793
Turns the launch firework effect into an effect section.
Takes into consideration the bug fixes and enhances to the EffFireworkLaunch since.
Requesting same reviewers.