Skip to content

Commit e695c3b

Browse files
feat: add permission checker
1 parent 95a5877 commit e695c3b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package app.simplecloud.plugin.api.shared.permission
2+
3+
/**
4+
* @author Niklas Nieberler
5+
*/
6+
7+
fun interface PermissionChecker<P> {
8+
9+
/**
10+
* Checks the permission by a player
11+
* @param player to check the permission
12+
* @param name of the permission
13+
*/
14+
fun checkPermission(player: P, name: String): Boolean
15+
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package app.simplecloud.plugin.api.velocity.permission
2+
3+
import app.simplecloud.plugin.api.shared.permission.PermissionChecker
4+
import com.velocitypowered.api.proxy.Player
5+
6+
/**
7+
* @author Niklas Nieberler
8+
*/
9+
10+
class VelocityPermissionChecker : PermissionChecker<Player> {
11+
12+
override fun checkPermission(player: Player, name: String): Boolean {
13+
return player.hasPermission(name)
14+
}
15+
16+
}

0 commit comments

Comments
 (0)