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

Check Line of Sight of Player Before Block Placements and Opening Containers #1679

Open
wants to merge 145 commits into
base: 2.0
Choose a base branch
from

Conversation

Axionize
Copy link
Contributor

@Axionize Axionize commented Aug 23, 2024

This prevents players from using Freecam and interacting with blocks through walls. For example, accessing a chest behind a wall they shouldn't have access to.

Can be used to check all block interactions, but currently only checks containers for maximum performance. The list of blocks being interacted with to check will be configurable to all or a list.

This also prevents laggy players from being able to break a block in regions protected by plugins such as Worldguard and quickly opening a container behind it before the block reappears client side.

Currently making a PR To ask for feedback on:

  • What changes, if any, need to be made for latency compensation.
  • If suggested configuration options are appropriate
  • What the result of using the Player.BLOCK_INETRACTION_RANGE attribute will have for players on < 1.20.5
  • Note that the existing code has comments and print statements to make it more clear what's going on that may not be in the final PR.

EDIT: This could have the potential to close #1498

@Axionize Axionize changed the title RFC (Request for Comment) RFC: Prevent Illegal Freecam & Laggy Container/Block Interactions Aug 23, 2024
@ManInMyVan
Copy link
Contributor

this should be done in rotationplace, but I added a review anyways (I gave up halfway through so some things don't have comments)

@Anthony01M
Copy link
Contributor

This needs a lot of rework and seems like is still in draft, please change the status from Open to Draft

@Axionize Axionize marked this pull request as draft August 23, 2024 05:44
@Axionize
Copy link
Contributor Author

Axionize commented Aug 23, 2024

I wrote this as a quick port of a hacky spigot-api based check I had in a custom plugin for a very specific problem on a specific server, which I wanted to move to a proper anticheat.

I'm not that familiar with GrimAC's codebase, but I noticed that Sam was working on something similar: #1238

I cleaned it up a little here: https://github.com/Axionize/Grim. I'm going take to modifying Sam's check to also work for Blocks/Entities/Digging in the reach-wall-check branch and continue providing dev builds with the reach check's and latest GrimAC updates in the 2.0 branch in my fork.

I plan to make a separate draft for this new approach when I'm ready to get some feedback.

I greatly appreciate your time and help, and I'd still like for the code to be reviewed. If there's anything I can do to make that easier, please let me know.

@SamB440
Copy link
Collaborator

SamB440 commented Aug 23, 2024

The problem with my draft is that it falses due to the movement threshold, you could be anywhere within 0.03 and thus the raytrace is wrong

@Axionize
Copy link
Contributor Author

Wasn't that bug fixed past 1.18.2?

I've taken a look at how you account for this movement and I don't see anything obviously wrong with it? Are there any reproducible circumstances under which you can cause it to fail I can investigate?

In any case, I don't see anything wrong with disabling the 0.03 offsets if the player's version is > 1.18.2. It would be better than nothing and most modern (non 1.7/1.8) servers only keep support for the last couple of major MC versions anyways.

Please let me know if I'm overlooking something or you have a better alternative in mind.

@ManInMyVan
Copy link
Contributor

Wasn't that bug fixed past 1.18.2?

no it's still a thing, it's just 0.0002 and not 0.03, it's just called "0.03" because it's the same mechanic

@Axionize Axionize changed the title RFC: Prevent Illegal Freecam & Laggy Container/Block Interactions Check Line of Sight of Player Before Block Placements and Opening Containers Aug 25, 2024
@Axionize Axionize marked this pull request as ready for review August 25, 2024 03:17
Axionize and others added 23 commits September 28, 2024 01:37
# Conflicts:
#	src/main/java/ac/grim/grimac/utils/collisions/CollisionData.java
Co-authored-by: ManInMyVan <[email protected]>
Co-authored-by: ManInMyVan <[email protected]>
Co-authored-by: ManInMyVan <[email protected]>
Co-authored-by: ManInMyVan <[email protected]>
@Dg32z
Copy link
Contributor

Dg32z commented Oct 11, 2024

2024-10-11.21-04-19.mp4

false flag

@Axionize
Copy link
Contributor Author

Client and server version? What block is the plant on the right?

@Dg32z
Copy link
Contributor

Dg32z commented Oct 12, 2024

Quote reply
Reference in n

1.21.1 Folia
1.21.1 vailla
coral

@Dg32z
Copy link
Contributor

Dg32z commented Oct 14, 2024

Client and server version? What block is the plant on the right?

2024-10-14.12-56-44.mp4
2024-10-14.12-54-26.mp4

@Dg32z
Copy link
Contributor

Dg32z commented Oct 14, 2024

Client and server version? What block is the plant on the right?

2024-10-14.12-56-44.mp4
2024-10-14.12-54-26.mp4

ver
[13:11:23 INFO]: Checking version, please wait...
[13:11:24 INFO]: This server is running Luminol version 1.21.1-DEV-dev/1.21.1@791d374 (2024-08-31T08:19:01Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
You are 13 version(s) behind
Download the new version at: https://github.com/LuminolMC/Luminol
Previous version: 1.21.1-DEV-7c312e7 (MC: 1.21.1)
pl
[13:11:24 INFO]: Server Plugins (5):
[13:11:24 INFO]: Bukkit Plugins:
[13:11:24 INFO]: - GrimAC, LiteBans, LuckPerms, PlaceholderAPI, PlugManX

@Dg32z
Copy link
Contributor

Dg32z commented Oct 14, 2024

2024-10-14.13-12-52.mp4

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.

Block/Entity interaction/digging should be blocked through walls
6 participants