Skip to content
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

Closed
wants to merge 32 commits into from

Conversation

TheLimeGlass
Copy link
Collaborator

@TheLimeGlass TheLimeGlass commented Mar 21, 2023

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.

TFSMads and others added 26 commits June 9, 2022 10:52
 - 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
@TheLimeGlass TheLimeGlass added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Mar 21, 2023
@Moderocky Moderocky changed the base branch from master to dev/feature September 18, 2023 10:23
Copy link
Member

@sovdeeth sovdeeth left a 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

@sovdeeth
Copy link
Member

sovdeeth commented Apr 7, 2024

Closing due to 6+ months of inactivity.

@sovdeeth sovdeeth closed this Apr 7, 2024
@TheLimeGlass TheLimeGlass reopened this Apr 29, 2024
Comment on lines +65 to +67
"\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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"\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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "last " + word + " " + type;
return "the last " + word + " " + type;

it's better to be verbose for toString IMO

Comment on lines +129 to +130
if (sectionNode != null)
trigger = loadCode(sectionNode, "firework launch", FireworkSectionLaunchEvent.class);
Copy link
Member

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.

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" 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")
Copy link
Member

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

@sovdeeth sovdeeth added 2.9 Targeting a 2.9.X version release and removed 2.9 Targeting a 2.9.X version release labels Jun 30, 2024
@sovdeeth
Copy link
Member

Closing due to inactivity

@sovdeeth sovdeeth closed this Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants