RayTraceAntiXray icon indicating copy to clipboard operation
RayTraceAntiXray copied to clipboard

Spectators are not excluded

Open OrangeCatUnderscore opened this issue 1 year ago • 1 comments

Spectators should be excluded, or at least have different logic. Currently, things that spectators can see get obscured when clipping through blocks underground. Maybe this could be a config option?

2024-10-10_23 35 22 2024-10-10_23 35 27

OrangeCatUnderscore avatar Oct 11 '24 04:10 OrangeCatUnderscore

Currently existing solutions

Thank's for your suggestion. RayTraceAntiXray makes use of Paper's built-in Anti-Xray, which already has a bypass permission. Using a permission plugin like LuckPerms you can assign permissions to players based on their gamemode context.

However, this solution doesn't work if you want to switch dynamically between gamemodes while being in the world. In order for the changes to take effect, you would have to reload (i.e. refresh or resend) all chunks that the player has currently loaded after switching between gamemodes. (Note that the linked project is outdated and won't work anymore.)

What I could implement in RayTraceAntiXray

The thing is, in your use case, you don't actually care about blocks that aren't exposed to air, I guess? You only want to reveal the blocks that you can possibly see as spectator. Those are exactly the blocks that are ray traced by RayTraceAntiXray. I can add a bypass for those blocks by just treating them as "seen by the player".

However, I wouldn't implement the bypass based on the player's gamemode, but more general using a permission (similar to the Anti-Xray bypass permission) that you can enable in the config. You can then still bind it to a gamemode using a permission plugin as explained above.

stonar96 avatar Oct 12 '24 09:10 stonar96