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

ProjectileLaunchedScriptEvent updates #2701

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

MC-Samuel
Copy link
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.
@@ -449,6 +449,9 @@ public class BukkitImplDeprecations {
// Added 2025/01/04
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
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

@@ -51,6 +54,9 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
if (!path.tryObjectSwitch("by", shooter)) {
Copy link
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 projectile;
private LocationTag location;
public ProjectileLaunchEvent event;
public EntityTag shooter;

@Override
public boolean couldMatch(ScriptPath path) {
Copy link
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
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
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
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

fire(event);
EntityTag.forgetEntity(projectile);
EntityTag.forgetEntity(event.getEntity());
Copy link
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
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