Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Commit 1462fb5

Browse files
authored
Custom Kit permissions v.1.3.4 (#108)
* Custom Kit permissions * v1.3.4 * v1.3.4 custom kit perms * Update README.md * default perms
1 parent 5c00c5b commit 1462fb5

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Select kits from a form! Just do /kit and get kits info and select it if availab
1818
## Permissions
1919
- kit.command - Permission to use /kit
2020
- kit.sign - Permission to make kit sign.
21-
- kit.(kitname) - Permission to use kit specified after kit.
21+
- Custom Kit permissions - You can edit kits.yml to change permission for every kit, default is kit.(kitname).
2222
- kit.freepass - Permission to free pass any kit cooldown and one-kit-per-life check.
2323

2424
## Features

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: KitUI
22
author: Infernus101
33
api: [3.4.0]
44
main: Infernus101\KitUI\Main
5-
version: 1.3.3
5+
version: 1.3.4
66
permissions: # kit permissions - kit.<kit name>
77
kit.command:
88
description: kit command!

resources/kits.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ testkit:
4444

4545
# Info to show when selected a Kit in UI form
4646
info: "This kit is too op XD Cost: 50$"
47+
48+
# Custom Kit perms, CaSe sEnSiTiVe
49+
permission: "kit.testkit"
4750
testkit2:
4851

4952
items:
@@ -72,6 +75,8 @@ testkit2:
7275

7376
info: "Kit 2! Cost: 250$"
7477

78+
permission: "kit.testkit2"
79+
7580
testkit3:
7681

7782
items:
@@ -99,4 +104,6 @@ testkit3:
99104
image-url: ""
100105

101106
info: "Kit 3! Cost: 150$"
107+
108+
permission: "kit.testkit3"
102109
...

src/Infernus101/KitUI/Kit.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public function __construct(Main $pl, array $data, string $name){
3535
if(isset($this->data["money"]) and $this->data["money"] != 0){
3636
$this->cost = (int) $this->data["money"];
3737
}
38+
if(!isset($this->data["permission"])){
39+
$this->data["permission"] = "kit." . $this->name;
40+
}
3841
}
3942

4043
public function getName() : string{
@@ -160,7 +163,7 @@ public function processTimer(){
160163
}
161164

162165
public function testPermission(Player $player) : bool{
163-
return $player->hasPermission("kit.".strtolower($this->name)) or $player->hasPermission("kit.".$this->name);
166+
return $player->hasPermission($this->data["permission"]);
164167
}
165168

166169
public function save(){

0 commit comments

Comments
 (0)