Skip to content

Conversation

georgereuben
Copy link

@georgereuben georgereuben commented Oct 17, 2025

Problem

Currently none of the Leash related syntax work with boats meaning you will have to use Reflect and paper syntax instead.

Solution

Updated ExprLeashHolder and EffLeash to use Paper's Leashable instead of the LivingEntity interface.

Testing Completed

Tested with quickTest, skriptTest and Junit tasks


Completes: #8239

@georgereuben georgereuben requested a review from a team as a code owner October 17, 2025 05:24
@georgereuben georgereuben requested review from Efnilite and cheeezburga and removed request for a team October 17, 2025 05:24
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Oct 17, 2025
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.

Would also benefit from some tests, if possible. Test that you can leash a living entity, a non-living entity, and ensure that a non-leashable just returns null and doesn't throw exceptions. See the README in the tests directory for guidance on adding a test file!

@Override
@Nullable
public Entity convert(LivingEntity entity) {
public Entity convert(Leashable entity) {
Copy link
Member

@sovdeeth sovdeeth Oct 17, 2025

Choose a reason for hiding this comment

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

It's not safe to cast like this. You're accepting any entity (using entity in the pattern) without checking whether it will truly be a Leashable.
image

Copy link
Author

Choose a reason for hiding this comment

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

I see. SInce I cannot add Leashable in the pattern, the other solution I have tried now is to update the convert method to accept Entity objects and then add a check within the convert method. Please let me know if this works.

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Oct 17, 2025
@sovdeeth sovdeeth changed the base branch from master to dev/patch October 17, 2025 05:34
@sovdeeth sovdeeth moved this to In Review in 2.13 Releases Oct 18, 2025
@georgereuben
Copy link
Author

Would also benefit from some tests, if possible. Test that you can leash a living entity, a non-living entity, and ensure that a non-leashable just returns null and doesn't throw exceptions. See the README in the tests directory for guidance on adding a test file!

Okay will do

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. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants