-
-
Notifications
You must be signed in to change notification settings - Fork 417
Adds interaction entity syntaxes #8291
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
Adds interaction entity syntaxes #8291
Conversation
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.
Haven't looked at code in detail, but this is missing last attacker support
See ExprLastInteractionPlayer, same goes for last attack date in ExprLastInteractionDate. |
No, ExprLastAttacker (unless it already works?) |
Interaction extends Entity, so ExprLastAttacker should work fine (?). Though idk if it would due to getLastDamageCause()? |
sovdeeth
left a comment
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.
lot of edits needed for code quality and conventions
requested comments don't cover everything
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Outdated
Show resolved
Hide resolved
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Outdated
Show resolved
Hide resolved
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Show resolved
Hide resolved
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Outdated
Show resolved
Hide resolved
...va/org/skriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionHeight.java
Outdated
Show resolved
Hide resolved
...va/org/skriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionHeight.java
Outdated
Show resolved
Hide resolved
...va/org/skriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionHeight.java
Outdated
Show resolved
Hide resolved
...kriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionResponsiveness.java
Outdated
Show resolved
Hide resolved
...kriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionResponsiveness.java
Outdated
Show resolved
Hide resolved
...kriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionResponsiveness.java
Outdated
Show resolved
Hide resolved
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.
As per Sovde's review of following coding conventions, things I've noticed
- Use SyntaxRegistry to register elements
- Forgot to load the InteractionModule via main Skript class
- No
finals - Use
@Exampleinstead of@Examples - Each example should be in it's own
@Example - One liner
@Exampleand@Descriptionshould not be encased in{} - Inline Nullable annotation, i.e.
@Nullable blahorblah @Nullable [] - No 1 letter variable names
- Tests
- Expression change should allow changing of multiple interactions, not just one
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Show resolved
Hide resolved
...ain/java/org/skriptlang/skript/bukkit/interactions/elements/conditions/CondIsResponsive.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/interactions/InteractionModule.java
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/interactions/elements/effects/EffMakeResponsive.java
Outdated
Show resolved
Hide resolved
...rg/skriptlang/skript/bukkit/interactions/elements/expressions/ExprInteractionDimensions.java
Outdated
Show resolved
Hide resolved
.../org/skriptlang/skript/bukkit/interactions/elements/expressions/ExprLastInteractionDate.java
Outdated
Show resolved
Hide resolved
.../org/skriptlang/skript/bukkit/interactions/elements/expressions/ExprLastInteractionDate.java
Show resolved
Hide resolved
...rg/skriptlang/skript/bukkit/interactions/elements/expressions/ExprLastInteractionPlayer.java
Outdated
Show resolved
Hide resolved
...rg/skriptlang/skript/bukkit/interactions/elements/expressions/ExprLastInteractionPlayer.java
Outdated
Show resolved
Hide resolved
APickledWalrus
left a comment
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.
Implementation/design is great, just a couple formatting/readability things.
| interaction: | ||
| name: interaction¦s | ||
| pattern: interaction[plural:s] | ||
| pattern: interaction([plural:s]| entit(plural:ies|y)) |
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.
Might be clearer to use two separate patterns here
| private boolean responsive; | ||
| @Override | ||
| public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) { | ||
| responsive = !parseResult.hasTag("unresponsive"); |
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.
might make more sense to just put a parse tag on responsive rather than negating, but not a huge deal
|
|
||
| @Override | ||
| public @Nullable Date convert(Entity entity) { | ||
| if (entity instanceof Interaction interaction) { |
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.
I think a guard clause would be better here
Problem
No syntax currently exists for interaction entities. SkBee used to have it, but it is disabled along with its display syntaxes in favor of Skript's.
Solution
This PR introduces several new syntaxes for each aspect of interaction entities.
Includes Height, Width, Responsiveness, Last interaction/attack date/player and a condition for responsiveness.
Testing Completed
Manually tested scripts, all syntax works locally. Can add tests if wanted :D
Supporting Information
None
Completes: none
Related: none