maruohon / litematica

A modern client-side schematic mod for Minecraft
GNU Lesser General Public License v3.0
720 stars 217 forks source link

Should not set gamerule on a server to silence Command Feedback, instead suppress client-side #105

Open OscarVanL opened 4 years ago

OscarVanL commented 4 years ago

Hi, I have been using Litematica to paste a schematic into a creative server I play on.

One of the things I notice is that whenever I start the pasting process I get the error: "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."

I contacted the admin to investigate what command this was caused by, and he said it was the mod executing: /gamerule sendCommandFeedback false

There are three reasons why it's undesirable for this command to be executed:

  1. Users will think the mod is misbehaving because of the error.
  2. Players on servers are unlikely to have access to /gamerule commands.
  3. If I did have gamerule permissions, I believe this would suppress command feedback for all players on the server rather than just myself.

I would argue that performing /gamerule commands on a server is beyond the remit of this mod. Instead, the mod should intercept the player's chat messages and hide these messages. In other words, this should be client-side rather than server-side.

OscarVanL commented 4 years ago

I had a precursory look and it appears /gamerule sendCommandFeedback false can be sent by two classes, TaskFillArea.java and TaskPasteSchematicPerChunkCommand.java.

See here.

In TaskFillArea.java there's a check: if (this.isClientWorld) before sending this command, but in TaskPasteSchematicPerChunkCommand.java there is no such check. If I am correct in my assumption, this is a check to see if the player is on a singleplayer world or a multiplayer server.

I suspect this issue may be an unintended omission of the this.isClientWorld check for TaskPasteSchematicPerChunkCommand.java.

I'll see if this helps, and if so make a PR.

maruohon commented 4 years ago

It is sending it intentionally whenever it uses the /setblock based tasks, however you are correct this is not a nice & clean solution. I guess I'll switch to just suppressing the chat messages on the client, as the GameRule won't even suppress the massive command feedback console spam on the server side anyway... Also in the future there will be a server side mod/component that will allow direct pasting on servers as well without spamming vanilla commands. But obviously that wouldn't work on vanilla servers so the command based paste variant will also stay.

OscarVanL commented 4 years ago

Could you give me a hand with the stages for Compilation?

When I first tried building litematica it was apparent I needed to include malilib, liteloader and asm as these are dependency for compilation (otherwise I got various compilation errors like error: package fi.dy.masa.malilib.gui.util.Message does not exist). Gradle shows all of these classes as being missing.

How should I be adding these dependencies to the project for compilation?

maruohon commented 4 years ago

Do you mean just for compiling, or also setting up a modding environment? If you want a modding environment, I just happened to explain my works space setup yesterday on the SciCraft Discord: https://discord.gg/scicraft

But the basic setup is running the following commands (assuming you were to use Eclipse, otherwise omit that argument and just import the build.gradle file to IDEA, I believe):

After those you can do ./gradlew build and it will compile the mod and put it into builds/libs/filename.jar. I'm not sure if you can run the build command without the setup command on Fabric, but I'm pretty sure it doesn't work at least for LiteLoader and Rift.

OscarVanL commented 4 years ago

Thank you :)