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

Rework entity visibility #6867

Open
wants to merge 22 commits into
base: dev/feature
Choose a base branch
from
Open

Conversation

Efnilite
Copy link
Contributor

@Efnilite Efnilite commented Jul 5, 2024

Description

Adds support for the hideEntity, showEntity and canSee(Entity) and removes the player-only equivalents, which are functionally equivalent. Also updates the Hidden Players syntax to match the current style guide and to improve the naming of the variable required for reveal hidden players of {_p}.

I wasn't sure on how to do the test for the can see condition, as this will have to be done with JUnit to mock the player, but I couldn't get it to work properly with canSee. pls help :)


Target Minecraft Versions: 1.19+ (Skript 2.10)
Requirements: none
Related Issues: #6795

@cheeezburga
Copy link
Contributor

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

@Efnilite
Copy link
Contributor Author

Efnilite commented Jul 5, 2024

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

Not sure about that, since the entity one has only been around since Spigot 1.19, but idk

@cheeezburga
Copy link
Contributor

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

Not sure about that, since the entity one has only been around since Spigot 1.19, but idk

You should just be able to change which kind of type is accepted in the pattern based on whether or not a certain method exists, if that makes sense.

@sovdeeth
Copy link
Member

sovdeeth commented Jul 5, 2024

You can just change it entirely since 2.10 will be 1.19+

Copy link
Contributor

@ShaneBeee ShaneBeee left a comment

Choose a reason for hiding this comment

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

Just a few little things

@Efnilite Efnilite changed the title Add entity visibility Rework entity visibility Jul 5, 2024
@Efnilite Efnilite requested a review from ShaneBeee July 5, 2024 22:18
Copy link
Contributor

@cheeezburga cheeezburga left a comment

Choose a reason for hiding this comment

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

Just some small things I saw - I think some of them are just preference so up to you. Stuff like the star imports tho are pretty up there.

src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
@Efnilite Efnilite requested a review from sovdeeth July 7, 2024 16:59
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.

re: mock tests, you would need to provide your own logic implementation for canSee, since mocked objects have no inherent logic. I'm not sure if a junit test here is worth it.

sovdeeth added a commit that referenced this pull request Jul 13, 2024
Shouldn't be in the scope of this PR.
@Efnilite Efnilite requested a review from sovdeeth July 13, 2024 20:32
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.

what's the status of the junit tests?

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jul 14, 2024
@Efnilite
Copy link
Contributor Author

what's the status of the junit tests?

i think the EffEntityVisibility test is fine, but not really sure how to improve the one for CondCanSee. maybe adding an entity to a collection when it's hidden and then canSee checking that list? suggestions welcome :)

@sovdeeth
Copy link
Member

what's the status of the junit tests?

i think the EffEntityVisibility test is fine, but not really sure how to improve the one for CondCanSee. maybe adding an entity to a collection when it's hidden and then canSee checking that list? suggestions welcome :)

That'd work! As long as there's some basic logic implementation.

@Efnilite Efnilite requested a review from sovdeeth July 19, 2024 21:49
@Efnilite Efnilite requested a review from sovdeeth July 21, 2024 18:32
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
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants