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

Implementing respawn location. #998

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

svaningelgem
Copy link
Contributor

@svaningelgem svaningelgem commented Apr 23, 2024

Description

Adding respawn location attribute.

Creating this as a draft because I see there is a respawn function available (and tested). But I don't know exactly what .respawn() should do: should it go to the respawn location, or to the bed? What happens exactly?

Checklist

The following items should be checked before the pull request can be merged.

  • Code follows existing style.
  • Unit tests added (if applicable).

@Thorinwasher
Copy link
Contributor

Thorinwasher commented Apr 24, 2024

should it go to the respawn location, or to the bed? What happens exactly?

I recomend looking into the Paper code for this, as our behavior in mockbukkit is meant to copy that of paper. Anyhow for your specific question; it looks like there is only one variable that defines the respawn location in Paper. The bed respawn location is that location, here's the implementation of one of the methods:

    public Location getBedSpawnLocation() {
        return this.getRespawnLocation();
    }

I hope that clears that up for you

@svaningelgem
Copy link
Contributor Author

Thanks for the hint @Thorinwasher! I have now a copy of the papers code on my computer.
The changes are now in this branch.

@svaningelgem svaningelgem marked this pull request as ready for review April 24, 2024 10:59
@Thorinwasher
Copy link
Contributor

The changes are now in this branch.

Good! Now you need to change the formatting of the code to follow the same style as everything else.

@svaningelgem
Copy link
Contributor Author

No ruff or black or anything like that for java? :'(

@svaningelgem svaningelgem requested a review from a team as a code owner April 24, 2024 19:42
{
return bedSpawnLocation;
}
public @Nullable Location getRespawnLocation() { return this.respawnLocation; }
Copy link
Contributor

Choose a reason for hiding this comment

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

This here is what I meant reformat the code. Here's an example

Suggested change
public @Nullable Location getRespawnLocation() { return this.respawnLocation; }
public @Nullable Location getRespawnLocation()
{
return this.respawnLocation;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, this should have been reformatted now.

Copy link

sonarcloud bot commented Apr 25, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Thorinwasher Thorinwasher merged commit 5975e36 into MockBukkit:v1.20 Apr 25, 2024
3 checks passed
@svaningelgem svaningelgem deleted the setRespawnLocation branch April 25, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants