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

Fix inconsistencies between offline/online spawn position getter #11960

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lulu13022002
Copy link
Contributor

Original: #8243
Also deprecated the old HumanEntity#getPotentialRespawnLocation since it doesn't track the respawn angle.

@Lulu13022002 Lulu13022002 requested a review from a team as a code owner January 12, 2025 18:05
*/
@Nullable
public Location getRespawnLocation();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering, what really is the rule for interfaces and explicit public modifiers? I have seen files/PRs with and I have seen files/PRs without.

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know, it was an unnecessary rule enforced by spigot.

@Warriorrrr Warriorrrr added type: bug Something doesn't work as it was intended to. scope: api labels Jan 12, 2025
Comment on lines -563 to -568
/**
* Gets the Location where the player will spawn at, null if they
* don't have a valid respawn point.
*
* @return respawn location if exists, otherwise null.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

The Javadocs have been removed on this method. Is this intentional, or are you going to be adding different Javadocs soon?

Copy link
Contributor

Choose a reason for hiding this comment

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

iirc it should now inherit from offline player?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think JDs are inherited by default?

Copy link
Member

Choose a reason for hiding this comment

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

oh, no, nvm, they are, ineritDoc is for additive

@Machine-Maker Machine-Maker linked an issue Jan 12, 2025 that may be closed by this pull request
@Lulu13022002
Copy link
Contributor Author

This also fix Player#getRespawnLocation that consume the respawn anchor in the nether if binded

Comment on lines +300 to +304
default Location getRespawnLocation() {
return this.getRespawnLocation(false); // keep old behavior for offline players
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on deprecating this method (without overload) altogether?
Player extends OfflinePlayer, and both have different default chunk loading behavior, which is quite confusing (also would be nice to specify the default behavior in respective javadocs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the javadoc, not sure for the deprecation, i kinda expect offline player data to be less accurate than online by default. What i think is confusing is the fact that an online player extends an offline player in the api.

Copy link
Contributor

Choose a reason for hiding this comment

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

What i think is confusing is the fact that an online player extends an offline player in the api.

Yes, that was my concern. Technically, you can have OfflinePlayer object representing an online Player instance (#getOfflinePlayer too returns online player if present), so you may call the method on an offline player expecting not to load chunks, but they will load due to the object being an online player.

New devs might stumble upon this quirk and will have to account for it. Deprecation would require to explicitly specify the wanted behavior, but I don't have a strong feeling against leaving this as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: api type: bug Something doesn't work as it was intended to.
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

Player vs OfflinePlayer getBedSpawnLocation
7 participants