-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Conversation
[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.
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
modules/player/src/main/java/net/hollowcube/player/PlayerImpl.java
Outdated
Show resolved
Hide resolved
[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.
[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.