Skip to content

Commit 7899710

Browse files
committed
Remove fabric-permissions-api from silk-core
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
1 parent 6484336 commit 7899710

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

silk-core/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ plugins {
1414

1515
dependencies {
1616
modApi("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
17-
18-
modCompileOnly("me.lucko:fabric-permissions-api:0.3.1")
1917
}
2018

2119
val modName by extra("$projectTitle Core")
Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package net.silkmc.silk.core.entity
22

3-
import me.lucko.fabric.api.permissions.v0.Permissions
4-
import net.fabricmc.loader.api.FabricLoader
5-
import net.minecraft.server.level.ServerPlayer
63
import net.minecraft.world.entity.player.Player
74
import net.silkmc.silk.core.server.executeCommand
85

@@ -14,26 +11,3 @@ import net.silkmc.silk.core.server.executeCommand
1411
fun Player.executeCommand(command: String) {
1512
server?.executeCommand(command, this.createCommandSourceStack())
1613
}
17-
18-
/**
19-
* Checks if a player has a given permission.
20-
*
21-
* If
22-
* [Fabric Permissions API](https://github.com/lucko/fabric-permissions-api/)
23-
* is not installed, then it will fall back to the permission level and
24-
* test it against the player's permission level.
25-
*
26-
* Operators have a permission level of 4, normal users have a permission
27-
* level of 0. It is unclear what exactly 1-3 mean.
28-
*
29-
* @param permission The permission to check
30-
* @param fallbackPermissionLevel The permission level to fall back to if
31-
* the fabric permissions api is not present
32-
* @return If the player has the appropriate permissions
33-
*/
34-
fun ServerPlayer.hasPermission(permission: String, fallbackPermissionLevel: Int = 2): Boolean {
35-
return if (FabricLoader.getInstance().isModLoaded("fabric-permissions-api-v0"))
36-
Permissions.check(this, permission, fallbackPermissionLevel)
37-
else
38-
hasPermissions(fallbackPermissionLevel)
39-
}

0 commit comments

Comments
 (0)