Skip to content

ProjectileLaunchedScriptEvent updates#2701

Merged
tal5 merged 4 commits intoDenizenScript:devfrom
MC-Samuel:projectile
Mar 6, 2025
Merged

ProjectileLaunchedScriptEvent updates#2701
tal5 merged 4 commits intoDenizenScript:devfrom
MC-Samuel:projectile

Conversation

@MC-Samuel
Copy link
Copy Markdown
Contributor

  • <context.shooter> added to "ProjectileLaunchedScriptEvent"
  • <context.entity> deprecated and replaced with <context.projectile> since there are technically multiple entities.

- <context.entity> deprecated and replaced with <context.projectile> since there are technically multiple entities.
public static Warning playEffectSpecialDataListInput = new FutureWarning("playEffectSpecialDataListInput", "List input for the special_data argument in playeffect command is now deprecated. Please use a MapTag instead.");

// Added 2025/01/23
public static Warning projectileLaunchedEntityContext = new FutureWarning("projectileLaunchedEntityContext", "'context.entity' in the '<projectile>/<entity> launched' event is deprecated in favor of 'context.projectile'.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the 'projectile launched' event


@Override
public boolean matches(ScriptPath path) {
if (!path.tryObjectSwitch("by", shooter)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be placed below the primary test

public EntityTag shooter;

@Override
public boolean couldMatch(ScriptPath path) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if you're editing this event anyway, it'd be nice to modernize the format


public ProjectileLaunchedScriptEvent() {
registerCouldMatcher("<entity> launched");
registerCouldMatcher("projectile launched");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is redundant, <entity> covers it for registration purposes

Copy link
Copy Markdown
Member

@tal5 tal5 left a comment

Choose a reason for hiding this comment

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

Can also remove the @Regex thing in the meta comment when modernizing events

yield projectile;
}
case "projectile" -> projectile;
case "shooter" -> shooter;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need #getDenizenObject on shooter

shooter = projectile.getShooter();
fire(event);
EntityTag.forgetEntity(projectile);
EntityTag.forgetEntity(event.getEntity());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason to call #getEntity again here?

@MC-Samuel MC-Samuel requested a review from tal5 January 29, 2025 21:49
@tal5 tal5 merged commit dc0e487 into DenizenScript:dev Mar 6, 2025
@MC-Samuel MC-Samuel deleted the projectile branch March 6, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants