stonar96 / RayTraceAntiXray

Paper plugin for server-side async multithreaded ray tracing to hide ores that are exposed to air using Paper Anti-Xray engine-mode 1.
MIT License
128 stars 26 forks source link

Spectators are not excluded #27

Open OrangeCatUnderscore opened 1 week ago

OrangeCatUnderscore commented 1 week ago

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

stonar96 commented 1 week ago

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.