Skip to content

Server policies - #548

Open
personalized-advertising wants to merge 23 commits into
MinecraftFreecam:mainfrom
personalized-advertising:server-config
Open

Server policies#548
personalized-advertising wants to merge 23 commits into
MinecraftFreecam:mainfrom
personalized-advertising:server-config

Conversation

@personalized-advertising

Copy link
Copy Markdown

The server can now define a set of policies for freecam mod users, i.e disabling clipping or freecam entirely, much more fine-grained than #547 as you requested.

You can implement this now and then if you later want to make a server-side mod its as simple as doing this from the server:

public static final String FREECAM_POLICY_CHANNEL = "freecam:server_config";

public static void sendFreecamPolicy(Player player, boolean allowFreecam, boolean allowClipping, boolean allowFullbright, boolean allowInteract) {
    String json = """
            {
              "allowFreecam": %s,
              "allowClipping": %s,
              "allowFullbright": %s,
              "allowInteract": %s
            }
            """.formatted(
            allowFreecam,
            allowClipping,
            allowFullbright,
            allowInteract
    );
	
    player.sendPluginMessage(FREECAM_POLICY_CHANNEL, json.getBytes(StandardCharsets.UTF_8));
}

Untested, especially the forge code.

@MattSturgeon MattSturgeon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

As-is, there are a few build failures, open design questions, and a fragmented commit history.

For future reference, grouping commits logically by feature or unit of work (rather than per-file) makes changes much easier to review. Chris Beams' guide to commit messages is a great benchmark for this. On this repository, I also tend to use Conventional Commits, though that isn't a strict requirement.

To save you from having to go through tedious review cycles, I'm going to hold off on reviewing in more detail for now. This and #547 will serve as valuable reference implementations and inspiration when I have dedicated time to sit down and work on this feature.

I'll leave this open for now to keep it on the radar and allow you to iterate, if you choose. Thanks again for laying down the groundwork!

Comment thread forge/src/main/java/net/xolt/freecam/forge/FreecamForge.java Outdated
@Override
public void onInitializeClient() {
ModConfig.setup();
//? if >=1.20.5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask why we're only targeting 1.20.5+? Are we using a packet type that was introduced in that version? Or maybe the FabricServerPolicyNetworking API was added in that version?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask why we're only targeting 1.20.5+? Are we using a packet type that was introduced in that version? Or maybe the FabricServerPolicyNetworking API was added in that version?

its because its based on the newer payload format where it has payload type etc.
The mod making new releases for unsupported versions does complicate things a bit, can I ask why there are releases for 1.17 etc? For modded players who want to use old versions can they not just use the older freecam releases from when that version was relevant?

@personalized-advertising

Copy link
Copy Markdown
Author

Thanks for working on this!

As-is, there are a few build failures, open design questions, and a fragmented commit history.

For future reference, grouping commits logically by feature or unit of work (rather than per-file) makes changes much easier to review. Chris Beams' guide to commit messages is a great benchmark for this. On this repository, I also tend to use Conventional Commits, though that isn't a strict requirement.

To save you from having to go through tedious review cycles, I'm going to hold off on reviewing in more detail for now. This and #547 will serve as valuable reference implementations and inspiration when I have dedicated time to sit down and work on this feature.

I'll leave this open for now to keep it on the radar and allow you to iterate, if you choose. Thanks again for laying down the groundwork!

You should look at "Files changed" as a whole, as I implemented the code in an IDE but then copied over the changes file by file using github's built in editor, its a clunky workflow but works for one-off PRs like these.

Also that is my bad, I will remove the forge code.

Also yes this PR can be iterated on by you hopefully it serves as a good starting point, from my side I am just a server developer who wants better compatibility so longer term back and forth for this PR isn't ideal for my as I am already stretched across many projects, hope you understand.

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.

2 participants