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

## #43: Prevent players from swimming up waterfalls #46

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Nixotica
Copy link
Contributor

[Problem]

Players can swim up waterfalls in areas where we want waterfalls as decoration but also need to restrict access.

[Solution]

Well there is none so far, since we tested and setting a player's hunger to 6 or lower does not work, since it is not implemented in Minestom to stop players from swimming or sprinting in this state.

Also added some comments about potential structuring of handling these types of events when we have a solution.

[Problem]

Players can swim up waterfalls in areas where we want waterfalls as decoration but also need to restrict access.

[Solution]

Well there is none so far, since we tested and setting a player's hunger to 6 or lower does not work, since it is not implemented in Minestom to stop players from swimming or sprinting in this state.

Also added some comments about potential structuring of handling these types of events when we have a solution.
Copy link
Contributor

@GreatWyrm GreatWyrm left a comment

Choose a reason for hiding this comment

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

A couple of minor tweaks needed, but I'm fine with the design of this.

event.getSpawnInstance().setBlock(5, 43, 5, Ore.fromNamespaceId("unnamed:gold_ore").asBlock());
event.getSpawnInstance().setBlock(4, 43, 5, Ore.fromNamespaceId("unnamed:diamond_ore").asBlock());
player.getInventory().addItemStack(Item.fromNamespaceId("unnamed:diamond_pickaxe").asItemStack());
event.getSpawnInstance().setBlock(5, 43, 5, Ore.fromNamespaceId("starlight:gold_ore").asBlock());
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove these changes, as I am making this change in a separate PR.

import net.minestom.server.instance.block.Block;
import org.jetbrains.annotations.NotNull;

public class PlayerBubbleColumnSinkEvent implements PlayerInstanceEvent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unsure if an event is strictly necessary right now. It may be useful in the future, but I'm uncertain if it needs to be included here.

@GreatWyrm GreatWyrm linked an issue Sep 24, 2022 that may be closed by this pull request
mworzala and others added 4 commits September 26, 2022 23:02
[Problem]

Players can swim up waterfalls in areas where we want waterfalls as decoration but also need to restrict access.

[Solution]

Handle player position packets by checking if they are in a bubble column, cancel their ability to sprint (fast swim) if so.

[Testing]

This does work partially, however there must be some discrepancy with how a user's position is tracked when they are swimming already. If you load into the given test environment, and start swimming in the normal water, then move to the bubble column, it will sometimes not cancel your swimming. We could also potentially check within a radius of the 8 blocks around the player if that's the issue.

Another potential issue with this solution is players with high ping could navigate around this by not sending a position packet until they've climbed up the waterfall on client side, and then each packet gets sent and processed but won't return them to their original location.
@Nixotica Nixotica closed this Sep 27, 2022
@Nixotica Nixotica reopened this Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent players from swimming up waterfalls
3 participants