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

ExprPlayerViewDistance - re-enable this expression #5333

Merged
merged 13 commits into from
Feb 7, 2023
Merged

ExprPlayerViewDistance - re-enable this expression #5333

merged 13 commits into from
Feb 7, 2023

Conversation

ShaneBeee
Copy link
Contributor

Description

This PR aims to re-enable the view distance expression.
This was previously removed as it was "not supported" in Paper starting in 1.14.
I'm not entirely sure which version it was re-enabled, but I do know this has been working since at least 1.17
My guess would be 1.14-1.16.x this is not working. Generally no one uses 1.14/1.15, and very very few use 1.16.x, so we shouldn't need to worry.

If the server version doesn't have this enabled:

  • get -> will return the server's view distance
  • change -> an error will be sent to console letting the user know this is NOT a Skript bug

Target Minecraft Versions: none
Requirements: none
Related Issues: none

@ShaneBeee ShaneBeee added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jan 8, 2023
@Pikachu920
Copy link
Member

instead of writing the error to console on failure, is it possible to error on acceptsChange if it's unsupported?

@ShaneBeee
Copy link
Contributor Author

instead of writing the error to console on failure, is it possible to error on acceptsChange if it's unsupported?

unfortunately there is nothing in the API regarding if it does/doesn't work, therefor no way to check until its actually executed

@kiip1
Copy link
Contributor

kiip1 commented Jan 8, 2023

On 1.19.3 the method is Player#getClientViewDistance()

@ShaneBeee
Copy link
Contributor Author

ShaneBeee commented Jan 8, 2023

On 1.19.3 the method is Player#getClientViewDistance()

that is to get the view distance set on the client, not the view distance the server has set for the client,
as per docs:

Get the player's current client side view distance.
Will default to the server view distance if the client has not yet communicated this information,

@kiip1
Copy link
Contributor

kiip1 commented Jan 8, 2023

On 1.19.3 the method is Player#getClientViewDistance()

that is to get the view distance set on the client, not the view distance the server has set for the client,

as per docs:

Get the player's current client side view distance.

Will default to the server view distance if the client has not yet communicated this information,

I see, should be ok then.

@AyhamAl-Ali
Copy link
Member

Note: It's better to mention the note (about the 1.14 issue and it would return bukkit view distance in a specific case) in the docs description

@ShaneBeee
Copy link
Contributor Author

Note: It's better to mention the note (about the 1.14 issue and it would return bukkit view distance in a specific case) in the docs description

Good call, a note has been added to the docs.

Copy link
Contributor

@TheLimeGlass TheLimeGlass left a comment

Choose a reason for hiding this comment

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

Why can't we use Spigot's Player#getClientViewDistance? This will allow getting on Spigot servers.

@ShaneBeee
Copy link
Contributor Author

Why can't we use Spigot's Player#getClientViewDistance? This will allow getting on Spigot servers.

This is completely unrelated.
Player#getClientViewDistance() will return the view distance set on the client. Completely not related to the server at all.

@TheLimeGlass
Copy link
Contributor

TheLimeGlass commented Jan 27, 2023

Why can't we use Spigot's Player#getClientViewDistance? This will allow getting on Spigot servers.

This is completely unrelated. Player#getClientViewDistance() will return the view distance set on the client. Completely not related to the server at all.

Can that be disclosed in the syntax description? Even kiip1 called the same question.

@ShaneBeee
Copy link
Contributor Author

Why can't we use Spigot's Player#getClientViewDistance? This will allow getting on Spigot servers.

This is completely unrelated. Player#getClientViewDistance() will return the view distance set on the client. Completely not related to the server at all.

Can that be disclosed in the syntax description? Even kiip1 called the same question.

ok description has been updated.
Also I re-added in the method check, as I removed that by accident.

@AyhamAl-Ali AyhamAl-Ali merged commit 33c49f8 into SkriptLang:master Feb 7, 2023
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.

7 participants