fabric: check permissions using fabric-permissions-api
This commit is contained in:
parent
c01445dd1e
commit
149ffffe8e
3 changed files with 5 additions and 1 deletions
|
|
@ -50,6 +50,8 @@ dependencies {
|
||||||
modImplementation("net.fabricmc", "fabric-loader", Versions.fabricLoader)
|
modImplementation("net.fabricmc", "fabric-loader", Versions.fabricLoader)
|
||||||
modImplementation(fabricApi.module("fabric-command-api-v1", Versions.fabricApi))
|
modImplementation(fabricApi.module("fabric-command-api-v1", Versions.fabricApi))
|
||||||
|
|
||||||
|
modImplementation(include("me.lucko", "fabric-permissions-api", "0.1-SNAPSHOT"))
|
||||||
|
|
||||||
api(include(project(":cloud-core"))!!)
|
api(include(project(":cloud-core"))!!)
|
||||||
api(include(project(":cloud-brigadier"))!!)
|
api(include(project(":cloud-brigadier"))!!)
|
||||||
api(include(project(":cloud-services"))!!)
|
api(include(project(":cloud-services"))!!)
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import cloud.commandframework.fabric.argument.server.MessageArgument;
|
||||||
import cloud.commandframework.fabric.data.Message;
|
import cloud.commandframework.fabric.data.Message;
|
||||||
import cloud.commandframework.meta.CommandMeta;
|
import cloud.commandframework.meta.CommandMeta;
|
||||||
import io.leangen.geantyref.TypeToken;
|
import io.leangen.geantyref.TypeToken;
|
||||||
|
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.CommandOutput;
|
import net.minecraft.server.command.CommandOutput;
|
||||||
|
|
@ -134,7 +135,7 @@ public final class FabricServerCommandManager<C> extends FabricCommandManager<C,
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(@NonNull final C sender, @NonNull final String permission) {
|
public boolean hasPermission(@NonNull final C sender, @NonNull final String permission) {
|
||||||
final ServerCommandSource source = this.getBackwardsCommandSourceMapper().apply(sender);
|
final ServerCommandSource source = this.getBackwardsCommandSourceMapper().apply(sender);
|
||||||
return source.hasPermissionLevel(source.getMinecraftServer().getOpPermissionLevel());
|
return Permissions.check(source, permission, source.getMinecraftServer().getOpPermissionLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"fabric-command-api-v1": "*",
|
"fabric-command-api-v1": "*",
|
||||||
|
"fabric-permissions-api-v0": "*",
|
||||||
"minecraft": ">=1.14"
|
"minecraft": ">=1.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue