Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

Preventing C&B interactions through server side events.

BoskoVojinovic opened this issue ยท 2 comments

commented

Some Context:
I'm creating a roleplay server and a server-side mod to go with it. Naturally, I want to include C&B๐Ÿฅ‡, but I've run into a major issue when I need to prevent all player-world interactions.

So far I've tried to cancel a bunch of highest priority events tied to player interaction, from a quick look at your code, I see that you are only using 2 sub-events from that group. Sadly, all I've managed to do is prevent the placement and destruction of already chiseled blocks. No matter what events I cancel, the chisel will always bypass that and successfully edit the block.

So my questions are:
Is there any way to catch and/or cancel C&B events(mainly tied to world editing) just by using server-side events, since I don't want to create a client-side mod for this.
If that doesn't work, would a client-side mod help me or are you bypassing the event system entirely?

I know C&B has an API, but I was hoping for my master mod to be kind of generalized and not have special code for talking to mod(s).

Thanks :D

  • MC Version: 1.12.2
  • C&B Version: latest
commented

No, that can't be done only server-side due to the fact that C&B operations (including ones done by addons via the API) are performed first on the client, and then on the server. This must happen not only for visual reasons, but also because undo/redo functionality is implemented solely client-side.

commented

What @Phylogeny is saying is primarily accurate, MC always goes with the do it first, then verify later. Which is why you see things like blocks re-setting using spawn protection. This breaks down further in some cases with more complicated situations.

That said I know that Sponge has successfully implemented permissions using the native MC methods that C&B calls. ( I don't know if they reset the client however, it might just show changes on the client, but not reflect them on the server. )

If you do make a client side mod the events in the C&B API can block all chisel modifications.

Also Adventure mode (mode 2?) works if that is more up your alley.