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!

@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

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.

looking great

public boolean check(LivingEntity entity) {
return entity.isLeashed();
public boolean check(Entity entity) {
if(entity instanceof Leashable leashable) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(entity instanceof Leashable leashable) {
if (entity instanceof Leashable leashable) {

Comment on lines +7 to +8
leash {_cow} to {_holder}
unleash {_cow}
Copy link
Member

Choose a reason for hiding this comment

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

should assert that the leash holder of cow is properly set after each line

Copy link
Author

Choose a reason for hiding this comment

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

yes this is just a basic template, I was having some trouble with unrelated tests failing after adding this test. Probably some issue with cleanup and state restoring. I'll be adding assertions soon

@sovdeeth
Copy link
Member

Looks like Leashable isn't available on all versions we support, so you'll have to do some Skript.classExists() checks to make sure it's safe to use it.

java.lang.NoClassDefFoundError: io/papermc/paper/entity/Leashable
	at ch.njol.skript.effects.EffLeash.execute(EffLeash.java:64) ~[Skript.jar:?]

@georgereuben georgereuben marked this pull request as draft October 21, 2025 20:28
@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Oct 21, 2025
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.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants