-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
base: dev
Are you sure you want to change the base?
Conversation
MC-Samuel
commented
Jan 24, 2025
- <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'."); |
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.
the 'projectile launched' event
plugin/src/main/java/com/denizenscript/denizen/events/entity/ProjectileLaunchedScriptEvent.java
Show resolved
Hide resolved
@@ -51,6 +54,9 @@ public boolean couldMatch(ScriptPath path) { | |||
|
|||
@Override | |||
public boolean matches(ScriptPath path) { | |||
if (!path.tryObjectSwitch("by", shooter)) { |
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 be placed below the primary test
} | ||
|
||
public EntityTag projectile; | ||
private LocationTag location; | ||
public ProjectileLaunchEvent event; | ||
public EntityTag shooter; | ||
|
||
@Override | ||
public boolean couldMatch(ScriptPath path) { |
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 you're editing this event anyway, it'd be nice to modernize the format
// | ||
// --> | ||
|
||
public ProjectileLaunchedScriptEvent() { | ||
registerCouldMatcher("<entity> launched"); | ||
registerCouldMatcher("projectile launched"); |
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.
this is redundant, <entity>
covers it for registration purposes
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.
Can also remove the @Regex
thing in the meta comment when modernizing events
yield projectile; | ||
} | ||
case "projectile" -> projectile; | ||
case "shooter" -> shooter; |
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.
Need #getDenizenObject
on shooter
fire(event); | ||
EntityTag.forgetEntity(projectile); | ||
EntityTag.forgetEntity(event.getEntity()); |
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.
Any reason to call #getEntity
again here?