Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public final class LuckPermsBridgeClient {
static final String SNAPSHOT_UNCHANGED = "/luckperms/plugin/snapshot/unchanged";
static final String CHANGES = "/luckperms/plugin/changes";
static final String RESULTS = "/luckperms/plugin/changes/results";
static final String COMMANDS = "/luckperms/plugin/commands";

private LuckPermsBridgeClient() {}

Expand Down Expand Up @@ -370,6 +371,24 @@ public static CallResult putSnapshot(String json) {
return CallResult.success();
}

/** Replaces the site's command list for the Commands tab. */
public static CallResult putCommands(String json) {
GatewayResult raw = ProvinceSystemGateway.requestBytes(
"PUT",
COMMANDS,
json.getBytes(StandardCharsets.UTF_8),
"application/json"
);
if (!raw.ok) {
return CallResult.fail(raw.status, raw.error);
}
JsonObject root = object(raw.body);
if (root == null || !isTrue(root.get("ok"))) {
return CallResult.fail(raw.status, "Command list was not accepted");
}
return CallResult.success();
}

public static UnchangedResult snapshotUnchanged(String hash, long revision) {
JsonObject body = new JsonObject();
body.addProperty("hash", hash);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package net.tfminecraft.tfmcweb.luckperms;

import java.util.Map;
import java.util.function.Function;

import com.google.gson.JsonObject;

import net.tfminecraft.tfmcweb.api.LuckPermsBridgeClient.Change;
Expand Down Expand Up @@ -32,4 +35,10 @@ public interface BridgeStore {
* saves once, or changes nothing. Never throws for a refused change.
*/
ChangeResult apply(Change change);

/**
* @return each group's check on this server: true or false as LuckPerms resolves the
* permission, or null when the group has no node for it
*/
Map<String, Function<String, Boolean>> groupChecks();
}
Loading