Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
feature: support for fabric-permissions-api
Browse files Browse the repository at this point in the history
The aliases command now requires the `aliases.use` permission, which is granted by default.
Additionally, the external dependency on the entire Fabric API has been removed and now the command API module is jar-in-jar.
  • Loading branch information
Giggitybyte committed Apr 14, 2022
1 parent 3743c72 commit f0ddd6d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ version = "${project.mod_version}+${project.minecraft_version}"
group = project.maven_group

repositories {
// ...
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation include('me.lucko:fabric-permissions-api:0.1-SNAPSHOT')
modImplementation include(fabricApi.module("fabric-api-base", project.fabric_version));
modImplementation include(fabricApi.module('fabric-command-api-v1', project.fabric_version))
}

processResources {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
org.gradle.jvmargs=-Xmx1G

minecraft_version=1.18.1
yarn_mappings=1.18.1+build.22
loader_version=0.12.12
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3

mod_version=1.0.0
mod_version=1.1.0
maven_group=me.thegiggitybyte
archives_base_name=aliases

fabric_version=0.46.2+1.18
fabric_version=0.50.0+1.18.2
6 changes: 5 additions & 1 deletion src/main/java/me/thegiggitybyte/aliases/Aliases.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.stream.JsonReader;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.minecraft.command.CommandSource;
Expand Down Expand Up @@ -39,7 +40,10 @@ public void onInitializeServer() {
.suggests((ctx, builder) -> CommandSource.suggestMatching(ctx.getSource().getPlayerNames(), builder))
.executes(Aliases::fetchUsernameHistory);

var aliasesCommand = literal("aliases").then(stringArg).build();
var aliasesCommand = literal("aliases")
.requires(Permissions.require("aliases.use", true))
.then(stringArg).build();

dispatcher.getRoot().addChild(aliasesCommand);
});
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"depends": {
"java": ">=17",
"fabricloader": ">=0.12.12",
"fabric": "*",
"minecraft": "1.18.x"
"minecraft": ">=1.18.1"
}
}

0 comments on commit f0ddd6d

Please sign in to comment.